diff --git a/include/haproxy/activity-t.h b/include/haproxy/activity-t.h index 0f5210f69..24e9f79ac 100644 --- a/include/haproxy/activity-t.h +++ b/include/haproxy/activity-t.h @@ -69,6 +69,8 @@ struct memprof_stats { unsigned long long free_calls; unsigned long long alloc_tot; unsigned long long free_tot; + void *info; // for pools, ptr to the pool + void *pad; // pad to 64 }; #endif diff --git a/src/activity.c b/src/activity.c index ee5577102..41beb4d81 100644 --- a/src/activity.c +++ b/src/activity.c @@ -726,6 +726,12 @@ static int cli_io_handler_show_profiling(struct appctx *appctx) chunk_appendf(&trash," [delta=%lld]", (long long)(entry->alloc_tot - entry->free_tot)); } + if (entry->info) { + /* that's a pool name */ + const struct pool_head *pool = entry->info; + chunk_appendf(&trash," [pool=%s]", pool->name); + } + chunk_appendf(&trash, "\n"); if (applet_putchk(appctx, &trash) == -1) diff --git a/src/pool.c b/src/pool.c index 6f3e41971..57dc079aa 100644 --- a/src/pool.c +++ b/src/pool.c @@ -734,6 +734,7 @@ void *__pool_alloc(struct pool_head *pool, unsigned int flags) bin = memprof_get_bin(__builtin_return_address(0), MEMPROF_METH_P_ALLOC); _HA_ATOMIC_ADD(&bin->alloc_calls, 1); _HA_ATOMIC_ADD(&bin->alloc_tot, pool->size); + _HA_ATOMIC_STORE(&bin->info, pool); } #endif if (unlikely(flags & POOL_F_MUST_ZERO)) @@ -763,6 +764,7 @@ void __pool_free(struct pool_head *pool, void *ptr) bin = memprof_get_bin(__builtin_return_address(0), MEMPROF_METH_P_FREE); _HA_ATOMIC_ADD(&bin->free_calls, 1); _HA_ATOMIC_ADD(&bin->free_tot, pool->size); + _HA_ATOMIC_STORE(&bin->info, pool); } #endif