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 A779AA00C5; Thu, 30 Apr 2020 12:34:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 08ECF1DB5A; Thu, 30 Apr 2020 12:34:35 +0200 (CEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30045.outbound.protection.outlook.com [40.107.3.45]) by dpdk.org (Postfix) with ESMTP id 2660F1DB42 for ; Thu, 30 Apr 2020 12:34:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AR7RZDd9wuT6Tvr345M6aIK7oTvFkTFaw4GjIt3pl7x61Eza8eqDJ6gOkJh1BXWuC7gQ+d1wxQSiHSZbjAUBjfGcGf3sPPx+saJopWIzJUq0334UZleFj8mP3bJznF1pFXKvg9R4NwqT+pcfvbzXgnGjtd7FxD2XO0cbZePAUWnl9BZKHL0Mnuboqca7qcsIRG86lzW/Gx/wuVzX93DVoiEVCxM9SYvDnOUntj/2GLMC1pNvO20kLTGsPy6zr0UnYhA27pOinPAQ/G54kT+Ebil69n86OGWIaBSS+lEclSgOpsTrvxh6iMhLmstr470xn+6w4ZijRyO775tteGrilA== 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=SqS251xRvXfK3h6hg2p1zWYdyidyUnSjiflNGAHgpBG4GZySNsRIWS5NPj1HDAVYFVgMz9CC2kiH1oejN7JO4njtQpVXFCbnt6NDkFL9xEsGa4+zYZ5qSPx6hw44lJgnjiKivmbkDUIgIasmfl7znMvdWwxzt6TF8Y+ATE6AP6N/GhedT212eoPe4OwD3d3p/AdWi6+tWsT+PVFCM8E9V5qKKUw7F0kJB6FJginV6WkJp7XEKxD/1yWXuw4tTWbyhxMdEP5VPx+YkrKbf4Z47wrtGIn/rXA0WxYqY0jGmevwajsixjg1zGkRh610xEyyXcbaq8OsSBDAQiOpielDxg== 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=gJZ4ohpqEua7IJwCEfOGw8wzMkC61HdGhXsRIYmRBJB+q9CgFHPsy34Tu+QUxFtHsYq/azf2AB6+BZKyGHgw1IJEGKN9XOlXCh9DmH9eOiJLUQ+kOk/GLnzqkGjyLcX8ZSNUTb9kquvX1qKkNtXm7RsxU/+hJ3th4YrBMlm9ZnA= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB5204.eurprd05.prod.outlook.com (2603:10a6:208:ef::29) 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 10:34:20 +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 10:34:20 +0000 From: Wisam Jaddo To: dev@dpdk.org, jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, gerlitz.or@gmail.com, l.yan@epfl.ch Cc: Suanming Mou Date: Thu, 30 Apr 2020 10:33:40 +0000 Message-Id: <20200430103341.1845-5-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430103341.1845-1-wisamm@mellanox.com> References: <20200430093249.6772-2-wisamm@mellanox.com> <20200430103341.1845-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR0P264CA0116.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::32) 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 PR0P264CA0116.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 10:34:15 +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: bca60d50-6e44-4c3d-9b43-08d7ecf20830 X-MS-TrafficTypeDiagnostic: AM0PR05MB5204:|AM0PR05MB5204: 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)(396003)(376002)(136003)(346002)(366004)(39860400002)(316002)(8676002)(52116002)(7696005)(478600001)(8936002)(186003)(5660300002)(55016002)(16526019)(4326008)(6666004)(26005)(36756003)(956004)(8886007)(2616005)(66556008)(2906002)(66476007)(66946007)(86362001)(107886003)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zQkCD6ljaTShpO85Vy01+B7Z56aQlwSFQG6b4wcftB4luwMHBHrDx1p0VC/abzlchgaHQz5p3NIfFlc4to75TsXS9lszLNQoQKGMpRHWIfq4yZB3+1D+SjJOjxD0jSfX12hxWu8s16oeK2+mXOA62pFefAhVWQyScOglRIRV10sOI1qkZM/6TpzPkm6CrSVgR51mqxbfVJj1LxxhsyI64r5wXgSBe9eC+LlOAX/hkplj1YQZG4cqsRQ2qXCRpQwye5Krh/HmCAhFhTaBTB1Xu/OBFtucS6X50ZhqNPOfxycdTdvXTbh2W54PsZytdNsF86ssMaP4aA03Mtyxbjs1q2lHJ78eDvifJN2tb2en6LbBm+XsZZkhsKCwyXSE83At2F8qjGwWNCGJitOTdB0y5k5HGAyqqA8nZqUiJZo4xtvFux+c9XNNW19gX54vt0/s X-MS-Exchange-AntiSpam-MessageData: rQd/uQ8V23BfbnCeN6EVEeKdSKuO+Kdu4RPMdEMYJ749YCBH41qw77OOj2WL2M8DDq2UyTq0QWr9lwsz331AvCxiUk/jur+POibiM5uGIBTeg2fPgFXdIKSUjnh9V5f3wJDJTo0Km/L+F/DVpsPb3A6PS8v/cz2e2IzHMktOtmX+ARVtf5HpLpKaQ8UsbzHVc0vb6tADGsZoqpiHCNfzIFPbgkBnTvdr/oJ8EL5o6BJBbtG1AbTNQfZVV/3nAWfxrZ4eD+vAYdhHUFHjiJ4fVBwQT0N8YudhtlTGlesw0ef4FdQxwWlXI0zMhuMzM4WVrBQ+T3VUyuDqIfZE2bN/VfJX0nG/NQ0Q+IYmZ7DaqaUkYyCf/cQol9+5geIH8a+1MyD9Iy2muG54t8DJgJg+grvDe2yvu6Enu5mA2/T8vRyYvg0JjSM+gKrKipHDr2FVk5LvEjFiDvzdP1WL2640c+TmOZxLeMVTREPYAtadvPbPJfPnRujjy93B7mSqw24pLrKkSbsHW+CKJJ79397DHmH5EjZfylIbunKqADB5Awfvzv0c2z5MkfC7kCOsw219d1zXdZmWZcsa1VEJNmqa7RHdmaZwsHQsldyAjLgn9smfyZWztRYm7oGG+vMoXNNk3bO5RlVowMYO15geS9A89fUFEYNdVKzUOmSmVzhxy/rmEk6FK91O2czJBiTK54WDciVncj36un+e3irZUKcCIic281UG+Wn6qz07Jn84TW2gt+V7IJbEwDWXpPA2u+pba/kSadDqA8uSJHBGcRllqAYq4xgzUeGCqy50nH/o9BA= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: bca60d50-6e44-4c3d-9b43-08d7ecf20830 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 10:34:16.3336 (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: NC2bTH2TwrIsprbxEdlx5bV3e4aSyckYa7jV4bmWRsT36+SxrdD0Z1FTdp4m5WmqGtC+5ReZUTrwOrGG7YRh+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5204 Subject: [dpdk-dev] [PATCH v4 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