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 94645A0597; Thu, 9 Apr 2020 17:44:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4CEDA1D162; Thu, 9 Apr 2020 17:43:24 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00053.outbound.protection.outlook.com [40.107.0.53]) by dpdk.org (Postfix) with ESMTP id 5F4891D14B for ; Thu, 9 Apr 2020 17:43:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=myn7Fv8RaZvwnmkapfvaUyr25AAI6HbHTTumt8C67M9RsgCQwui8N7ZbK4L6brwDU55zx6oKkah2KGQnrf2gTB03srYdMzroQjY6P4XkEnz8ZP6PsppXtibMvnSn/n9xiajdh7W/6zyy1F1lxRaj7+fPXDlRAONL8tayxOK//ucx/h9DZcZ0k/jCYnfDjkEp1f5QGXGCFFIsUg04QPpa/eGg+mZBwd3ZgLtyj4b2nWTPcxrJussxm4Z79cg8tRwh8xab0CyRfqi2DJlv610A0va9HC1FAeeX9cDDQafWVhYqxPxjadfp0vQLEHQIqK9EmCpdfcoouXteGAZn9cKydQ== 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=M05zpHKKsYouy1KeVll85YgoOnLuTEpR9IKjMEUOxM0=; b=DLyjydeVY7XNxIwPtyzhsZuk9IPxceT3+xPoIYmaK2NuUVFa6pGgtUIHe7l/xWbdPS9YsP6+VXN+O+DreGP08OCOZthCV5pKdeM7qrInITUc1KWKcjmc2grFDK2U4v0MaiVQHlPDCJXq0zQJYHJbXTXHZnI/HjZVD/BuAQlGpABZFc8EfDqCnsj32EvRHIy8/+Yf0vbEPLAVtETdvirMp2i31SVI9d/Lc3W/tzGvBZW76aJCC2CZUwlDV4KrHKj9E69BrFDQIA8RMOe5DXyUYPWOaeHjs/9EXbSyjEr6Doimc6/8C2XgSdYiswqdDL9D1QzGIEMGJUXYBPx9fBzM9A== 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=M05zpHKKsYouy1KeVll85YgoOnLuTEpR9IKjMEUOxM0=; b=aXJALDKXQJ2cZgxr489gR76bPx4E3rq7s5CNQlYdHZru+ZPZPXh5jzfVFZPsD0nUtXUBt3jW26IIAwB5/IHod/MZVr0wmhQHCRk+W4L4rHxYpdfYuIQ+wlZTQEt3HPvopJcHs7tf9rRYdzOU3umdwhyFUiNBejzTqj/EG6CkXzQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=wisamm@mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0SPR01MB0078.eurprd05.prod.outlook.com (2603:10a6:208:156::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15; Thu, 9 Apr 2020 15:43:19 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::6dbd:6f77:4519:eeb6]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::6dbd:6f77:4519:eeb6%5]) with mapi id 15.20.2878.023; Thu, 9 Apr 2020 15:43:19 +0000 From: Wisam Jaddo To: dev@dpdk.org, jackmin@mellanox.com, jerinjacobk@gmail.com Cc: thomas@monjalon.net, Suanming Mou Date: Thu, 9 Apr 2020 15:42:56 +0000 Message-Id: <20200409154257.11539-4-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200409154257.11539-1-wisamm@mellanox.com> References: <1584452772-31147-1-git-send-email-wisamm@mellanox.com> <20200409154257.11539-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR3P192CA0040.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:57::15) 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 PR3P192CA0040.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:57::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.17 via Frontend Transport; Thu, 9 Apr 2020 15:43:18 +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: 79209967-27e2-42db-5ed3-08d7dc9cba24 X-MS-TrafficTypeDiagnostic: AM0SPR01MB0078:|AM0SPR01MB0078: 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: 0368E78B5B 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:(10009020)(4636009)(396003)(39860400002)(346002)(376002)(136003)(366004)(66946007)(7696005)(1076003)(55016002)(2906002)(52116002)(5660300002)(66556008)(8936002)(8886007)(81156014)(86362001)(316002)(6666004)(26005)(186003)(8676002)(66476007)(16526019)(4326008)(107886003)(956004)(478600001)(2616005)(81166007)(36756003); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F+dtb/pELqlaoAosPnXPMz2pSSXuD/rlhTnA/5KIaCujmQe3uj0Z22KFp4Aq5fPkrqmfXfrByNReDUhiArPn1qpezn0fIeNHz2Qpyb7eVVU2yCUVwHi39PfK2JeyKIxUsp4+OXX6x27KxB/aBKnzkwx6PYPssLcEH94BP1oAxe+Fq6mDxPdCBSshpOJw4gyMjWM9jK1zfWsvB1wVxM41h0wnbFRQq7tLzIApEc4KC+bHJ/m5IFchgcL2I4NhlrvQfIaWT8GUVUccMT8NjB0cyoSFy48dodH42akZRDV82KRxM42xpQKMViYudLOGe+SawKzYwM1p7BVrkop1lMCYM6k7dJDkcX4HZNyk+Ge3IBxA08OE5Iq6SIHnr1uDxGrb2ekK7Jw9HqlCwn7vrvhzhSRUhEHFkNBrp4mo07iZWGXOgvHoo0JuY9rGoGUaDCKY X-MS-Exchange-AntiSpam-MessageData: RSxd4D/MnicaslALBkKcK3HvxWRP1/qYVWmGyTpkFEf8bFPQW27Z9CQGQYkiG1ZhUUj+7TjCvo7d/DXqYTVj38Q10eSQZq8iBW+L4NZqt5XAS6ONkW1XZLXCVefgVfWTJNm8h9Tg3rAO8ZB7xFu8LQ== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79209967-27e2-42db-5ed3-08d7dc9cba24 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2020 15:43:19.4437 (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: NffjIEFR2RJ1TypblVEuiv3Y+t4wjyGqvhULCJt3y6ydrjct2mHNvcx9I/nKzJOVWh7nI17A9/NtFtpcFL/YPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0SPR01MB0078 Subject: [dpdk-dev] [PATCH 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 84f2c0c39b..438fbf850a 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