From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BC10EA00C5; Thu, 30 Apr 2020 11:33:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D89751DAC8; Thu, 30 Apr 2020 11:33:06 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2049.outbound.protection.outlook.com [40.107.22.49]) by dpdk.org (Postfix) with ESMTP id 2BC9B1DA9F for ; Thu, 30 Apr 2020 11:32:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=byuR9DHQx78H6mXCEFMPdgu0zB+oh4+FPhhg31QM0a+ZoLSFU9hqOHEYaNF/lARHObl+NtWR7q465/i5GcUanqf5W2x/yUNU//4jbIs/hhfDnelE7BtPVgpFWIP8Py8W4T7Kl12f0h/qDedMBnhBOwS3rhTVcQcw+8BB/C0Foi7L/Xrm70h2wGMwKvl7VQaSGCIrv+/c15ARQifpQVzpPoG6150Sf54OdewpNB3oVXs3P87b3HZGRR+MI0jfgO5fUMDyjN59XMYr5tIWt8Xoq6FCrWVm6JUOXOMpeG2HmpN5udvRfY1Oad0B+R5klsqnNhOf5oMtiuUV6NmSBjXgTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e+z3GRhpA/JAeLsnIdajdDSlqCGIqewjrDWqtdPh0JY=; b=ZK1y58yCnI0MhB833XJgJC5GkBe7wRjiDjBLpLCWxB1SLtHZYRij1bFhqJ5jR9LUbYcaa26rPP0uFiDrAhkn3Z221wlc2fbNcWZMBRGqTxtwpa4/POlziqy3BK2obV1qoV7L6pyyy9CyZuuTzzLNoYP9NLwR2WLZq8Hsk/rHfjg/DC1NcU7ukm76RUtrfYBExQr9WJTrHGaatWgSdOvSKuufc8RoJ/kucdleAN9XtSMQ+GHECwYKtt1TQ3ZdB8CzjxOE/e2pTbPZb9MLgtTf2fC7tH61pK01ih+kjIbMn3YyLJuuCS9gNkhuSnombDyf7RI620cW59g3MrcgGfdFuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e+z3GRhpA/JAeLsnIdajdDSlqCGIqewjrDWqtdPh0JY=; b=f9AaBKgS/zRQp78LhYSKSVLZ2R504ZXgGiBop3MKt9A5bB9TFUEbWdbTHY7KXPASqgJgTGQUrxzcW48AAk/VaXjUqdU3f8JIvMS/4Z1Oo3haQH2GkrR+hvGdlfgXeAmbuq3m7HTSrn+9inyosFN0P91rg7OPm2WpCi8ed8HAA/8= Authentication-Results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB6419.eurprd05.prod.outlook.com (2603:10a6:208:142::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 09:32:58 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc%6]) with mapi id 15.20.2937.028; Thu, 30 Apr 2020 09:32:58 +0000 From: Wisam Jaddo To: jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, gerlitz.or@gmail.com, l.yan@epfl.ch, dev@dpdk.org Cc: Suanming Mou Date: Thu, 30 Apr 2020 09:32:48 +0000 Message-Id: <20200430093249.6772-5-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430093249.6772-1-wisamm@mellanox.com> References: <20200430070823.24046-2-wisamm@mellanox.com> <20200430093249.6772-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR0P264CA0107.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::23) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR0P264CA0107.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 09:32:56 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f44ba34d-387d-47f5-35c0-08d7ece9776f X-MS-TrafficTypeDiagnostic: AM0PR05MB6419:|AM0PR05MB6419: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6610.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(376002)(346002)(39860400002)(136003)(2616005)(956004)(7696005)(52116002)(107886003)(2906002)(4326008)(16526019)(186003)(26005)(5660300002)(316002)(1076003)(8936002)(86362001)(36756003)(8676002)(478600001)(66946007)(66556008)(66476007)(55016002)(6666004)(8886007); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ib+udTmxcxzZVpKsfukZKV/0cUfpWdQtbK2ENeOvT5PnfbuO0uDfGnzH362JmqnLwa4nXrkJgNaETkbKcY1cXJ7IAgBWSgXQPSiDFfNnVfTJ6bUf44STF8LS2K7QbF3Js8TEJGmHEghUH4NShoZb6JnbKIC7I8U/gC/dBQnqDur6sM/cvbdtPgVTSi2NvpH5voLW/ufl9OF6BNjCHyBoxdsucrvK0RrM3syR6uDKfhPart6BJD5214A2r3wj4UGba1ehHvR8ha5Ud9fYvC5wuY3loBnINs+hE9dAViiIjklfhk8H4oRbf74y0X5INsB+SyXQCIBAsaOvoFE1hbfgwyWCYIVJuDSFRsI9u7hmZoGTl2tvSo/PjjhRSQ58APLAVQ2KDryPW1hZp2Hekd4ymjvAmxMyFbe1j04Qrajla9oZXMOVdPzgeXDdCb9BI9qm X-MS-Exchange-AntiSpam-MessageData: qsBr/NiFQ2INIi1XQ/FirU0pc8Tj9YRk68k9dIOVYiyRQ93uSjqra4UB4gHsFUR3ZdnRX2q+zH/OuEeze/CiuaujY+EDCZTC5h49gA26Skviua53tziHEEbCDoIVNRNWQSycgknOv4e28CXKIv6tG+vSVUF6mxYWs1Id4l+SVFLyM4cP82m8Le6/rxkW4MVKAdFQZKu/JxDTHIwkw8kPTalIFWJBPfXIdnx6xQ/rPRR7I951PMB/vw9J8MK+VZYo9/0JAOOXVX0SDaxXMgKIki2oyzSL4aXgNWw4GvO4st7q/+Q5A7/YXsT+DSs2vacw9dq+6sZ9A9r4Hm4xxKbkUlbjSgmc3KWgvp/ASIw4YIq3NMIOSyxnF4puGhoHJWIkHPs1+G5IJaVPj6CtLtxC/ndGLvDz/B1RO9RI2E+6NI9ASAdxt69asaW1prSYp0jR9QxSY+QpHGGXLMXxdBXfJi785dInNOmTDRB8llgecE0SYeOXhUG7jYuXA16ttgEmm0hIE0Uj0U0Jibz0r1oTge/ZQZ293WBBpFznNdQXH5Pmf4y4pejFB0vnkF+Dq4CNlqmzAotuI1ygc5EmM0r32mczhrl2XONnPqqXJPFJFjBO2c90sFWerPn7HtjnoM1y0Kt5vbN3OHaJj2jlcEizni3PUS2ICzgMZs5HHdZyXKUSdeP8FE4MDoKBCU2cZh+XgXUht11uBvQMaHwPXVyS1cxzA1QPQYnhq5F7svhGmugWpAyMkc+4+JV3HIlJQgayaE4/Vm1Fx13mLSWeBuAWRyY5gKAbKeEevHu4pBY+Aus= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f44ba34d-387d-47f5-35c0-08d7ece9776f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 09:32:57.3645 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LWlpvvYFmjBdjTYWyMUjGZGwi0XeKtWW4b7zbkEt0PmhOpi2dfAw2A5XNN+pjK6PMAs1J9zD+PaoqH5i7LLpoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6419 Subject: [dpdk-dev] [PATCH v3 4/5] app/test-flow-perf: add memory dump to app X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Introduce new feature to dump memory statistics of each socket and a total for all before and after the creation. This will give two main advantage: 1- Check the memory consumption for large number of flows "insertion rate scenario alone" 2- Check that no memory leackage after doing insertion then deletion. Signed-off-by: Suanming Mou Signed-off-by: Wisam Jaddo --- app/test-flow-perf/main.c | 69 ++++++++++++++++++++++++++++++++++ doc/guides/tools/flow-perf.rst | 6 ++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 7c11c0b577..95435910de 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -62,6 +62,7 @@ static uint16_t flow_actions; static uint8_t flow_attrs; static volatile bool force_quit; static volatile bool dump_iterations; +static volatile bool dump_socket_mem_flag; static volatile bool delete_flag; static struct rte_mempool *mbuf_mp; static uint32_t nb_lcores; @@ -78,6 +79,7 @@ static void usage(char *progname) " iteration\n"); printf(" --deletion-rate: Enable deletion rate" " calculations\n"); + printf(" --dump-socket-mem: to dump all socket memory\n"); printf("To set flow attributes:\n"); printf(" --ingress: set ingress attribute in flows\n"); @@ -127,6 +129,7 @@ args_parse(int argc, char **argv) { "flows-count", 1, 0, 0 }, { "dump-iterations", 0, 0, 0 }, { "deletion-rate", 0, 0, 0 }, + { "dump-socket-mem", 0, 0, 0 }, /* Attributes */ { "ingress", 0, 0, 0 }, { "egress", 0, 0, 0 }, @@ -310,6 +313,8 @@ args_parse(int argc, char **argv) dump_iterations = true; if (!strcmp(lgopts[opt_idx].name, "deletion-rate")) delete_flag = true; + if (!strcmp(lgopts[opt_idx].name, "dump-socket-mem")) + dump_socket_mem_flag = true; break; default: usage(argv[0]); @@ -321,6 +326,62 @@ args_parse(int argc, char **argv) printf("end_flow\n"); } +/* Dump the socket memory statistics on console */ +static size_t +dump_socket_mem(FILE *f) +{ + struct rte_malloc_socket_stats socket_stats; + unsigned int i = 0; + size_t total = 0; + size_t alloc = 0; + size_t free = 0; + unsigned int n_alloc = 0; + unsigned int n_free = 0; + bool active_nodes = false; + + + for (i = 0; i < RTE_MAX_NUMA_NODES; i++) { + if (rte_malloc_get_socket_stats(i, &socket_stats) || + !socket_stats.heap_totalsz_bytes) + continue; + active_nodes = true; + total += socket_stats.heap_totalsz_bytes; + alloc += socket_stats.heap_allocsz_bytes; + free += socket_stats.heap_freesz_bytes; + n_alloc += socket_stats.alloc_count; + n_free += socket_stats.free_count; + if (dump_socket_mem_flag) { + fprintf(f, "::::::::::::::::::::::::::::::::::::::::"); + fprintf(f, + "\nSocket %u:\nsize(M) total: %.6lf\nalloc:" + " %.6lf(%.3lf%%)\nfree: %.6lf" + "\nmax: %.6lf" + "\ncount alloc: %u\nfree: %u\n", + i, + socket_stats.heap_totalsz_bytes / 1.0e6, + socket_stats.heap_allocsz_bytes / 1.0e6, + (double)socket_stats.heap_allocsz_bytes * 100 / + (double)socket_stats.heap_totalsz_bytes, + socket_stats.heap_freesz_bytes / 1.0e6, + socket_stats.greatest_free_size / 1.0e6, + socket_stats.alloc_count, + socket_stats.free_count); + fprintf(f, "::::::::::::::::::::::::::::::::::::::::"); + } + } + if (dump_socket_mem_flag && active_nodes) { + fprintf(f, + "\nTotal: size(M)\ntotal: %.6lf" + "\nalloc: %.6lf(%.3lf%%)\nfree: %.6lf" + "\ncount alloc: %u\nfree: %u\n", + total / 1.0e6, alloc / 1.0e6, + (double)alloc * 100 / (double)total, free / 1.0e6, + n_alloc, n_free); + fprintf(f, "::::::::::::::::::::::::::::::::::::::::\n"); + } + return alloc; +} + static void print_flow_error(struct rte_flow_error error) { @@ -657,6 +718,7 @@ main(int argc, char **argv) uint16_t nr_ports; int ret; struct rte_flow_error error; + int64_t alloc, last_alloc; nr_ports = rte_eth_dev_count_avail(); ret = rte_eal_init(argc, argv); @@ -666,6 +728,7 @@ main(int argc, char **argv) force_quit = false; dump_iterations = false; delete_flag = false; + dump_socket_mem_flag = false; flows_count = 4000000; iterations_number = 100000; flow_group = 0; @@ -686,7 +749,13 @@ main(int argc, char **argv) if (nb_lcores <= 1) rte_exit(EXIT_FAILURE, "This app needs at least two cores\n"); + last_alloc = (int64_t)dump_socket_mem(stdout); flows_handler(); + alloc = (int64_t)dump_socket_mem(stdout); + + if (last_alloc) + fprintf(stdout, ":: Memory allocation change(M): %.6lf\n", + (alloc - last_alloc) / 1.0e6); RTE_LCORE_FOREACH_SLAVE(lcore_id) diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index e07e659df5..28d452fd06 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -18,7 +18,8 @@ give different flow each time, and all other items will have open masks. The current design have single core insertion rate. In the future we may have a multi core insertion rate measurement support in the app. -The application also provide the ability to measure rte flow deletion rate. +The application also provide the ability to measure rte flow deletion rate, +in addition to memory consumption before and after the flows creation. Compiling the Application @@ -94,6 +95,9 @@ The command line options are: * ``--deletion-rate`` Enable deletion rate calculations. +* ``--dump-socket-mem`` + Dump the memory stats for each socket before the insertion and after. + Attributes: * ``--ingress`` -- 2.17.1