[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH 16/18] lib/ukalloc: Iterator for per-library statistics
Provides the `uk_alloc_foreach_libstats()` helper macro that can be used to iterate over the available library allocator statistics. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- lib/ukalloc/include/uk/alloc.h | 10 ++++++++++ lib/ukalloc/libstats.ld | 2 ++ 2 files changed, 12 insertions(+) diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.h index e7166dfa..5392fcfe 100644 --- a/lib/ukalloc/include/uk/alloc.h +++ b/lib/ukalloc/include/uk/alloc.h @@ -324,6 +324,16 @@ struct uk_alloc_libstats_entry { const char *libname; struct uk_alloc *a; /* default allocator wrapper for the library */ }; + +extern struct uk_alloc_libstats_entry _uk_alloc_libstats_start[]; +extern struct uk_alloc_libstats_entry _uk_alloc_libstats_end; + +#define uk_alloc_foreach_libstats(iter) \ + for ((iter) = _uk_alloc_libstats_start; \ + (iter) < &_uk_alloc_libstats_end; \ + (iter) = (struct uk_alloc_libstats_entry *) ((__uptr)(iter) \ + + ALIGN_UP(sizeof(struct uk_alloc_libstats_entry), 8))) + #endif /* CONFIG_LIBUKALLOC_IFSTATS_PERLIB */ #endif /* CONFIG_LIBUKALLOC_IFSTATS */ diff --git a/lib/ukalloc/libstats.ld b/lib/ukalloc/libstats.ld index 79a0a837..d38aecf2 100644 --- a/lib/ukalloc/libstats.ld +++ b/lib/ukalloc/libstats.ld @@ -1,7 +1,9 @@ SECTIONS { .uk_alloc_libstats : { + PROVIDE(_uk_alloc_libstats_start = .); KEEP (*(.uk_alloc_libstats)) + PROVIDE(_uk_alloc_libstats_end = .); } } INSERT BEFORE .data; -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |