From patchwork Mon Dec 27 10:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 105434 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E2DB7A0350; Mon, 27 Dec 2021 11:49:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94F8440683; Mon, 27 Dec 2021 11:49:55 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 22D5B4067B for ; Mon, 27 Dec 2021 11:49:53 +0100 (CET) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JMvVM3FphzZcDC; Mon, 27 Dec 2021 18:46:35 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 27 Dec 2021 18:49:51 +0800 Received: from localhost (10.174.242.157) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 27 Dec 2021 18:49:50 +0800 From: Yunjian Wang To: CC: , , , , , Yunjian Wang Subject: [dpdk-dev] [PATCH] app/testpmd: log the largest free block when dumping socket memory Date: Mon, 27 Dec 2021 18:49:33 +0800 Message-ID: X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.174.242.157] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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",