test: add malloc stats dump command
authorAnatoly Burakov <anatoly.burakov@intel.com>
Fri, 22 Dec 2017 09:51:00 +0000 (09:51 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 17 Jan 2018 23:20:31 +0000 (00:20 +0100)
This can be useful for checking if an autotest leaks memory after
its execution.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
test/test/commands.c

index 0473dac..b7f6068 100644 (file)
@@ -62,6 +62,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
+#include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_devargs.h>
@@ -163,13 +164,20 @@ static void cmd_dump_parsed(void *parsed_result,
                rte_eal_devargs_dump(stdout);
        else if (!strcmp(res->dump, "dump_log_types"))
                rte_log_dump(stdout);
+       else if (!strcmp(res->dump, "dump_malloc_stats"))
+               rte_malloc_dump_stats(stdout, NULL);
 }
 
 cmdline_parse_token_string_t cmd_dump_dump =
        TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
-                                "dump_physmem#dump_memzone#"
-                                "dump_struct_sizes#dump_ring#dump_mempool#"
-                                "dump_devargs#dump_log_types");
+                                "dump_physmem#"
+                                "dump_memzone#"
+                                "dump_struct_sizes#"
+                                "dump_ring#"
+                                "dump_mempool#"
+                                "dump_malloc_stats#"
+                                "dump_devargs#"
+                                "dump_log_types");
 
 cmdline_parse_inst_t cmd_dump = {
        .f = cmd_dump_parsed,  /* function to call */