[dpdk-dev] test: add malloc stats dump command

Message ID fd78c0b536cc0424ad3aacb0d888cef6efe8ebf0.1513867028.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anatoly Burakov Dec. 22, 2017, 9:51 a.m. UTC
  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 | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
  

Comments

Thomas Monjalon Jan. 17, 2018, 11:20 p.m. UTC | #1
22/12/2017 10:51, Anatoly Burakov:
> This can be useful for checking if an autotest leaks memory after
> its execution.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/test/test/commands.c b/test/test/commands.c
index 4097a33..f49f7e8 100644
--- a/test/test/commands.c
+++ b/test/test/commands.c
@@ -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>
@@ -160,13 +161,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 */