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 6A271A00C5; Thu, 30 Apr 2020 09:09:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3152A1D952; Thu, 30 Apr 2020 09:09:06 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60052.outbound.protection.outlook.com [40.107.6.52]) by dpdk.org (Postfix) with ESMTP id B10ED1D929 for ; Thu, 30 Apr 2020 09:08:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SpRApAAacOgix8+xlRlt5T/8QuE34EY0FpiWqDu97Fl2ywjubjfhubWprHgB9BR5i+7zI0sFyOCbBR21lnreEuSyT4nJtMDppfOtlZGq0jBG7xv6160uPNn8pV3u1Iyr0WT2CFINQ3jGi4ttMKyKl6BQpwW8jN+jU4bHE9999p1kjfwEqlb8LA/JOH+hsfzHCEvx4GHjJg85/MC+Pbv8jQGPxAfzpAQ1SF733H9KRX8TOZBdSBSuskND79g7PnAOnaD9W2d08iZL4Pn5jPvQcnpizADjzcwolIvN4D1jePdkWvAohDjT3MC48VAUc9ruiPgzarss4LXl2caxLiRe9w== 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=NrQ2YwXH5wUAGgyjK1JgL9pErrllGI/Xou+d+wP80UBS/HGoHlSkKC0rWjv6nuFIwlB41xl94d4DPqTaeWTHfgP70ke9SIYRO35nNvqvkVQw5de4Wqcxgv6B+r0PfWvfylv5gmM0cPRd1icGl5BzC9S2j7Ung3dkueiCRRc5zF9DvtMCxEHbiA/7B46uPtklGRsYMuH5j9lMQmRm3EKeGWCKc1Y87pmYGqC3ZrisCA8sZYkwu8rD/mByFioS2WNk9X3xIbjv+YoCVSmdcQ5oUzvvlWDIzfXILNEwPFQ8wUSmexG3on3PX956cvnb1UY5h34S8/iGC09gxm9aXdQ6jQ== 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=KHHD2LlFiGtErHZvPChokiqpb/aOsG1Hcx73RkG+8IIkoDgmYvThH2UdiuhA0jZbuBLWpQO5mVEwO9GqbVU/PCJr0HCFA1dXlrfgODbp1xVNOVCv1WfNDZ41f1u/NQ1liXJRiJ14tswCjQHTMLEW1s6fCznNHwUR6dx09dkScJU= 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 AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 07:08:41 +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 07:08:41 +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 07:08:22 +0000 Message-Id: <20200430070823.24046-5-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430070823.24046-1-wisamm@mellanox.com> References: <20200409154257.11539-1-wisamm@mellanox.com> <20200430070823.24046-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR3P191CA0051.EURP191.PROD.OUTLOOK.COM (2603:10a6:102:55::26) 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 PR3P191CA0051.EURP191.PROD.OUTLOOK.COM (2603:10a6:102:55::26) 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 07:08:40 +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: 30c5c59e-8c98-4c69-140b-08d7ecd5504e X-MS-TrafficTypeDiagnostic: AM0PR05MB6707:|AM0PR05MB6707: 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-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dU58yQDJkaggLkzoDzRzvZoBEeU9W5VUYlLy6u+G9ChCmWnjW2zUJ+DUU6NUGmx8g933Rxo+2+0AIiLWcX4tqU7aNbawLSLbO89Yw+0h/v/1R8AW/vNMQlErw9LLfjw9CWfJvFjDtaHGvPQvu3ZfdEK9DXzNGJlkdAf4GoIGDGSrs/WWAsS+09o6RM4xTkFcVSgjRMKTFgS+baegSFvhrdcKufb7+b9dV1jkh9y6N1NgfCnakCAL2SNBikeMi3TGz6/cPnB7MrZGGV7OW4EUs+4p088wp959tN9Uhcc6XrQf315ueOUEmiEqxb9NRyHUJecJbxUD/HiXJGTo+vCf4CgZEqxa93u53kl6GwSX+sbib3hRJcfWdRIN6R0gHzloKDnJTItYeagIEY72cnBbmX8yG9x5u0/onXauJLAZo4/KTbQ93dmyXsAEkmQ1419M 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)(39860400002)(136003)(366004)(346002)(376002)(396003)(66556008)(4326008)(1076003)(26005)(186003)(55016002)(66946007)(8886007)(16526019)(2906002)(2616005)(956004)(66476007)(36756003)(6666004)(8936002)(316002)(86362001)(8676002)(52116002)(5660300002)(478600001)(7696005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mzf9Q0Y6wCvrRnk5G8vHYXb2HUfkaQIvbdODWiO9jbQ/nFtADvFvlXsepFf2HZ6Ev01b7r1D8p6HP70rg/Yzhgxnp40orJzmzKuo1PbrcVuufPquVAwmGm0gJi4QVUKnMldLjcGw1HzesxD/fhR4/KQgStUpZEhPFQLo3j8YGmjbTmgAjolRLuNMkszTnpUnIWqZxLb4Fggh7+BFGx3+LfF6YMQq58Q6DIdndXapfT++RVdty5ogWFHY/LrirwtcZG0WFCSiD5ttAKjTVWhEeA65VU23DptM1xb/QXnRYpx1aiQoSxwFynr0lgmt4Axf8DBVg4/CUgwTr5PWqUf66c4cRBG3qVbwKS5j7HWmssS7uFiy6jD3Ihy/QFpeu0/iJEnZw2EGrj6kUTpw61FqNKmvrul7GaSaPtQxXhnVUfp1oblTgRr1wlhgWO4bpHfCwXZRl2NprK4be7yqHB6gKkUE5x0Odg4dM/n0MD5wjKS2M/+kLFW7hT8WZTJFJydO/pPOgsOoH+Ny32fT/19FYTIeTnZdYEB08X3MotZodDUKPMf485kij4nq4e2grxDonZy5dZlUinskN980LCdmvGWYsqWW4DFuf+UUpqs/2ky+76ZdHyr2/pNamzsZCw0F2HQRkrbsCj0k4hVNq3mafyPmuXXgsh+O6BGg/NqbmnnrBHLXgjb1EiGvyYh79Nv8CU3icqycFDwYy/cSMFbBA65+3r5O/XOGpwSZWWoA7U7Ddck4d8duRV7LwCHB1yIC1OCQD6rktIs0MJiyBcCHfAYLReAWdR30JRMMUI5CWC0= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30c5c59e-8c98-4c69-140b-08d7ecd5504e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 07:08:41.8976 (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: wXEzxK0mleblXiinViCL/7kH679DgDNZ1Yd+64Sy3kmohgq/wocXD7ps6EwL8J6CJpthKyEKzaasoWeisuOB2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6707 Subject: [dpdk-dev] [PATCH v2 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