summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-08-19 16:25:41 +0000
committerLennart Poettering <lennart@poettering.net>2006-08-19 16:25:41 +0000
commitc6ca9a85c375a0ecc3b205b05b7867b251676162 (patch)
tree1b9f219a87885ab4dfe5e161a6ca2ac782a358f3
parent57f0b08cc1c6be0afc4f563d41cacae7c5d820a9 (diff)
print per-type memory block statistics on "stat"
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1294 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/pulsecore/cli-command.c21
1 files changed, 20 insertions, 1 deletions
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;
}