From c6ca9a85c375a0ecc3b205b05b7867b251676162 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 19 Aug 2006 16:25:41 +0000 Subject: print per-type memory block statistics on "stat" git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1294 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/cli-command.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 811b96d2..8ea9262b 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -242,7 +242,19 @@ static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) { char s[256]; const pa_mempool_stat *stat; - assert(c && t); + unsigned k; + + static const char* const type_table[PA_MEMBLOCK_TYPE_MAX] = { + [PA_MEMBLOCK_POOL] = "POOL", + [PA_MEMBLOCK_POOL_EXTERNAL] = "POOL_EXTERNAL", + [PA_MEMBLOCK_APPENDED] = "APPENDED", + [PA_MEMBLOCK_USER] = "USER", + [PA_MEMBLOCK_FIXED] = "FIXED", + [PA_MEMBLOCK_IMPORTED] = "IMPORTED", + }; + + assert(c); + assert(t); stat = pa_mempool_get_stat(c->mempool); @@ -273,6 +285,13 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G pa_namereg_get_default_sink_name(c), pa_namereg_get_default_source_name(c)); + for (k = 0; k < PA_MEMBLOCK_TYPE_MAX; k++) + pa_strbuf_printf(buf, + "Memory blocks of type %s: %u allocated/%u accumulated.\n", + type_table[k], + stat->n_allocated_by_type[k], + stat->n_accumulated_by_type[k]); + return 0; } -- cgit