DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: log the largest free block when dumping socket memory
@ 2021-12-27 10:49 Yunjian Wang
  2022-01-18 16:17 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Yunjian Wang @ 2021-12-27 10:49 UTC (permalink / raw)
  To: dev
  Cc: xiaoyun.li, aman.deep.singh, xuemingl, dingxiaoxiong, xudingke,
	Yunjian Wang

Add log print of the largest free block in dump_socket_mem.
It is useful to also log when dumping socket memory.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 app/test-pmd/cmdline.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6e10afeedd..d7bddf065a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -9825,6 +9825,7 @@ dump_socket_mem(FILE *f)
 	size_t total = 0;
 	size_t alloc = 0;
 	size_t free = 0;
+	size_t greatest_free_size = 0;
 	unsigned int n_alloc = 0;
 	unsigned int n_free = 0;
 	static size_t last_allocs;
@@ -9840,22 +9841,27 @@ dump_socket_mem(FILE *f)
 		free += socket_stats.heap_freesz_bytes;
 		n_alloc += socket_stats.alloc_count;
 		n_free += socket_stats.free_count;
+		greatest_free_size = RTE_MAX(greatest_free_size, socket_stats.greatest_free_size);
 		fprintf(f,
-			"Socket %u: size(M) total: %.6lf alloc: %.6lf(%.3lf%%) free: %.6lf \tcount alloc: %-4u free: %u\n",
+			"Socket %u: size(M) total: %.6lf alloc: %.6lf(%.3lf%%) free: %.6lf max: %.6lf \t"
+			"count alloc: %-4u free: %u\n",
 			i,
 			(double)socket_stats.heap_totalsz_bytes / (1024 * 1024),
 			(double)socket_stats.heap_allocsz_bytes / (1024 * 1024),
 			(double)socket_stats.heap_allocsz_bytes * 100 /
 			(double)socket_stats.heap_totalsz_bytes,
 			(double)socket_stats.heap_freesz_bytes / (1024 * 1024),
+			(double)socket_stats.greatest_free_size / (1024 * 1024),
 			socket_stats.alloc_count,
 			socket_stats.free_count);
 	}
 	fprintf(f,
-		"Total   : size(M) total: %.6lf alloc: %.6lf(%.3lf%%) free: %.6lf \tcount alloc: %-4u free: %u\n",
+		"Total   : size(M) total: %.6lf alloc: %.6lf(%.3lf%%) free: %.6lf max: %.6lf \t"
+		"count alloc: %-4u free: %u\n",
 		(double)total / (1024 * 1024), (double)alloc / (1024 * 1024),
 		total ? ((double)alloc * 100 / (double)total) : 0,
 		(double)free / (1024 * 1024),
+		(double)greatest_free_size / (1024 * 1024),
 		n_alloc, n_free);
 	if (last_allocs)
 		fprintf(stdout, "Memory total change: %.6lf(M), allocation change: %.6lf(M)\n",
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-18 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 10:49 [dpdk-dev] [PATCH] app/testpmd: log the largest free block when dumping socket memory Yunjian Wang
2022-01-18 16:17 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).