mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Add arena-level name.
An arena-level name can help identify manual arenas.
This commit is contained in:
13
src/stats.c
13
src/stats.c
@@ -42,15 +42,18 @@ const char *arena_mutex_names[mutex_prof_num_arena_mutexes] = {
|
||||
assert(miblen_new == miblen + 1); \
|
||||
} while (0)
|
||||
|
||||
#define CTL_M2_GET(n, i, v, t) do { \
|
||||
#define CTL_MIB_GET(n, i, v, t, ind) do { \
|
||||
size_t mib[CTL_MAX_DEPTH]; \
|
||||
size_t miblen = sizeof(mib) / sizeof(size_t); \
|
||||
size_t sz = sizeof(t); \
|
||||
xmallctlnametomib(n, mib, &miblen); \
|
||||
mib[2] = (i); \
|
||||
mib[(ind)] = (i); \
|
||||
xmallctlbymib(mib, miblen, (void *)v, &sz, NULL, 0); \
|
||||
} while (0)
|
||||
|
||||
#define CTL_M1_GET(n, i, v, t) CTL_MIB_GET(n, i, v, t, 1)
|
||||
#define CTL_M2_GET(n, i, v, t) CTL_MIB_GET(n, i, v, t, 2)
|
||||
|
||||
/******************************************************************************/
|
||||
/* Data. */
|
||||
|
||||
@@ -1042,6 +1045,8 @@ JEMALLOC_COLD
|
||||
static void
|
||||
stats_arena_print(emitter_t *emitter, unsigned i, bool bins, bool large,
|
||||
bool mutex, bool extents, bool hpa) {
|
||||
char name[ARENA_NAME_LEN];
|
||||
char *namep = name;
|
||||
unsigned nthreads;
|
||||
const char *dss;
|
||||
ssize_t dirty_decay_ms, muzzy_decay_ms;
|
||||
@@ -1059,6 +1064,10 @@ stats_arena_print(emitter_t *emitter, unsigned i, bool bins, bool large,
|
||||
uint64_t uptime;
|
||||
|
||||
CTL_GET("arenas.page", &page, size_t);
|
||||
if (i != MALLCTL_ARENAS_ALL && i != MALLCTL_ARENAS_DESTROYED) {
|
||||
CTL_M1_GET("arena.0.name", i, (void *)&namep, const char *);
|
||||
emitter_kv(emitter, "name", "name", emitter_type_string, &namep);
|
||||
}
|
||||
|
||||
CTL_M2_GET("stats.arenas.0.nthreads", i, &nthreads, unsigned);
|
||||
emitter_kv(emitter, "nthreads", "assigned threads",
|
||||
|
||||
Reference in New Issue
Block a user