DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <xiaoyun.li@intel.com>, <aman.deep.singh@intel.com>,
	<xuemingl@nvidia.com>, <dingxiaoxiong@huawei.com>,
	<xudingke@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>
Subject: [dpdk-dev] [PATCH] app/testpmd: log the largest free block when dumping socket memory
Date: Mon, 27 Dec 2021 18:49:33 +0800	[thread overview]
Message-ID: <da0dc3b3ba2695d1ff1798fc6c921da6079f00d3.1640585898.git.wangyunjian@huawei.com> (raw)

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


             reply	other threads:[~2021-12-27 10:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27 10:49 Yunjian Wang [this message]
2022-01-18 16:17 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da0dc3b3ba2695d1ff1798fc6c921da6079f00d3.1640585898.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=dingxiaoxiong@huawei.com \
    --cc=xiaoyun.li@intel.com \
    --cc=xudingke@huawei.com \
    --cc=xuemingl@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).