mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-15 07:54:33 +00:00
MINOR: memprof: also report the totals and delta alloc-free
Already had to perform too many additions by external scripts, it's time to add the totals and delay alloc-free as a last line in the output of the "show memory profiling".
This commit is contained in:
parent
616491b7f7
commit
f5fb858bb7
@ -512,6 +512,8 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
struct sched_activity tmp_activity[256] __attribute__((aligned(64)));
|
||||
#if USE_MEMORY_PROFILING
|
||||
struct memprof_stats tmp_memstats[MEMPROF_HASH_BUCKETS + 1];
|
||||
unsigned long long tot_alloc_calls, tot_free_calls;
|
||||
unsigned long long tot_alloc_bytes, tot_free_bytes;
|
||||
#endif
|
||||
struct stream_interface *si = appctx->owner;
|
||||
struct buffer *name_buffer = get_trash_chunk();
|
||||
@ -652,6 +654,27 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
tot_alloc_calls = tot_free_calls = tot_alloc_bytes = tot_free_bytes = 0;
|
||||
for (i = 0; i < max_lines; i++) {
|
||||
tot_alloc_calls += tmp_memstats[i].alloc_calls;
|
||||
tot_free_calls += tmp_memstats[i].free_calls;
|
||||
tot_alloc_bytes += tmp_memstats[i].alloc_tot;
|
||||
tot_free_bytes += tmp_memstats[i].free_tot;
|
||||
}
|
||||
|
||||
chunk_appendf(&trash,
|
||||
"-----------------------|-----------------------------|\n"
|
||||
"%11llu %11llu %14llu %14llu| <- Total; Delta_calls=%lld; Delta_bytes=%lld\n",
|
||||
tot_alloc_calls, tot_free_calls,
|
||||
tot_alloc_bytes, tot_free_bytes,
|
||||
tot_alloc_calls - tot_free_calls,
|
||||
tot_alloc_bytes - tot_free_bytes);
|
||||
|
||||
if (ci_putchk(si_ic(si), &trash) == -1) {
|
||||
si_rx_room_blk(si);
|
||||
return 0;
|
||||
}
|
||||
|
||||
appctx->ctx.cli.i1 = 0; // reset first line to dump
|
||||
if ((appctx->ctx.cli.i0 & 4) == 0)
|
||||
appctx->ctx.cli.i0++; // next step
|
||||
|
Loading…
Reference in New Issue
Block a user