From patchwork Sun Mar 7 09:11:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wisam Monther X-Patchwork-Id: 88681 X-Patchwork-Delegate: thomas@monjalon.net 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 6554EA0562; Sun, 7 Mar 2021 10:12:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B739E22A32F; Sun, 7 Mar 2021 10:12:23 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2077.outbound.protection.outlook.com [40.107.244.77]) by mails.dpdk.org (Postfix) with ESMTP id 0622222A2F4 for ; Sun, 7 Mar 2021 10:12:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JtSR54eY2MmZa+MVt8EW0fpVs5zAMRjeGZq18TrBIhVSWpqCkg2TOThRjuBXQbIUCZqSLB6Rhfe7GKZwQ08c0ghY6JuPrmsd9kKmusKT6pDByn5NhnJrf0+dMLcNIDwVRArvwrwVo3Pm1JU5Aibp9oHTmH+WKEryPNpsCIj/CCPm1xVtLS0KxdvWM189+/u+780u+mx8NyRP44JPIUi/XXS/s6KuopdA6dlsYef6FLtHen5311/Sy2iXIZL7QWR/LSkB6DtoBeNzPm7/BatSdFVggmLIHu8d9fLgvF+mkxNrjlgU9SDhcrvPDw5SgGHgn4xKxxFvqWrAtAY0Au+KQw== 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=kHzuYpqhDFPLbS8TFa0kQ2R70un0RICthcjLlHQinYQ=; b=aYIGepyS2BfOiyop95ub2CAJLr92NNF5ni4ID5fQmFNvMqgpRzIgGdTnlzv1jDfoni84PYbBFpHUSESDoZxpLTYBOJ+Q/QCtDBgh6+POfzB/mgD2vhbog6nPRhxnlSdn6LlRCpa42j8KZMgo0spF5kGrfImfiErGHVepOnt56Ke4kJ3Mlopf7sIeiprIqgiMZDvnT7lqr6WxH8rUatLsIOUDWxm5u57uLlScSBVBMoQLiPQXgVFGtKdrB3AQIxrqtxrhTwRbFURtjKqddsbKKowNvyeHYPWnYMSibcDF8k92avLb+PpNJ3vpsya3eh8DSTc4MmYGuIvKJh+V6C4TUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kHzuYpqhDFPLbS8TFa0kQ2R70un0RICthcjLlHQinYQ=; b=nVHG4GvieUpDMcBcNKShYBU4QhwCKuqKWdfXcq+C5YX4UlNl4t9p0eAslvOKC1TaWzZhzHxJL9awrIdizdbmKq+aAms1zA0Ar07kw7IzJm/L9LTlNibZCDmpbuvM9XvzmvXQt0jnd3X83JbSm1yI4F7qp+l0nO42+PBsqwrY8EA= Received: from DM6PR06CA0098.namprd06.prod.outlook.com (2603:10b6:5:336::31) by CH2PR12MB4199.namprd12.prod.outlook.com (2603:10b6:610:a7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Sun, 7 Mar 2021 09:12:20 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:5:336:cafe::81) by DM6PR06CA0098.outlook.office365.com (2603:10b6:5:336::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Sun, 7 Mar 2021 09:12:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3912.17 via Frontend Transport; Sun, 7 Mar 2021 09:12:20 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 7 Mar 2021 09:12:18 +0000 From: Wisam Jaddo To: , , , , Date: Sun, 7 Mar 2021 11:11:58 +0200 Message-ID: <20210307091202.586-2-wisamm@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307091202.586-1-wisamm@nvidia.com> References: <20210307091202.586-1-wisamm@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83fdad56-1f8f-4d1b-5e75-08d8e1491cb5 X-MS-TrafficTypeDiagnostic: CH2PR12MB4199: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OCgqMQgMszzIG7MaduAE2d97nOmR8vrPpApkUJ/F3TiQiYntJWlfeOYNGKHEsgkxF7Psd1nV8oLOV83qOaF62rrt86OJ1HUXGqKam9+NnD5oXT/wF/K6+TBI8UmsMs4QYeY76w7pRXVIyUQUvuylgCP6dVdpbDQ8yzojStcO9FnX/EZPnqk8g8HPplyB7RQ/xAWiIJoMqKyh9r/mk9BvPigUvvo3/FqsegNsHO6FbMvC+3JLr0Y0Tg98SsSlhaiNZa1xKWNuG4EcE2nhj6crtDioZ5jHVQeg4Xemuj3llX7IyiIXLrSRR5sVY7MLzJf0BIXKJWKlDCZ4K8PaTJn8S3s2iqCnKodkFIawtOnrzh6Ucwd/aotIAyc0NcMqP/0ym82EakGWvdQwbK2WxwULW+4C1aJgqQYqzAih9oHlhBS/Bs+4O7Axp8sf2MJaqR09SOJXbLR9V5mi51S0cd3m/0yvr/FMMrtvi1ngo22ZAXxDt5C5c1XuIgCWwtXvA4Z3UQssXRafC7k2lpQTC/O3OPj796t8DlJh6nMi/UC4Zc/mJlbp78nBI2kxTpwXjXDtOQDJJQ04k5Yf3jrm1G0qTuCM1A/DvU8v7cBLbV76WHhMu+KP0xthDj1bJX7BkwV/74ObWusjI5Mqygzn6krMad16/OMMw8vdI2e9iMVZzGFCwCym+aeQlYIWaYN+RFBzD0d2h26VC4xbe1yU3tYUiw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(346002)(376002)(136003)(39860400002)(46966006)(36840700001)(16526019)(5660300002)(26005)(186003)(55016002)(7636003)(34020700004)(478600001)(426003)(336012)(356005)(36906005)(82310400003)(36860700001)(316002)(36756003)(82740400003)(110136005)(83380400001)(86362001)(2616005)(8936002)(47076005)(6666004)(1076003)(6286002)(70206006)(70586007)(2906002)(8676002)(7696005)(41533002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2021 09:12:20.2316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83fdad56-1f8f-4d1b-5e75-08d8e1491cb5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4199 Subject: [dpdk-dev] [PATCH 1/5] app/flow-perf: start using more generic wrapper for cycles 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 Sender: "dev" rdtsc() is x86 related, while this might fail for other archs, so it's better to use more generic API for cycles measurement. Signed-off-by: Wisam Jaddo --- app/test-flow-perf/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 99d0463456..8b5a11c15e 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -969,7 +969,7 @@ meters_handler(int port_id, uint8_t core_id, uint8_t ops) end_counter = (core_id + 1) * rules_count_per_core; cpu_time_used = 0; - start_batch = rte_rdtsc(); + start_batch = rte_get_timer_cycles(); for (counter = start_counter; counter < end_counter; counter++) { if (ops == METER_CREATE) create_meter_rule(port_id, counter); @@ -984,10 +984,10 @@ meters_handler(int port_id, uint8_t core_id, uint8_t ops) if (!((counter + 1) % rules_batch)) { rules_batch_idx = ((counter + 1) / rules_batch) - 1; cpu_time_per_batch[rules_batch_idx] = - ((double)(rte_rdtsc() - start_batch)) - / rte_get_tsc_hz(); + ((double)(rte_get_timer_cycles() - start_batch)) + / rte_get_timer_hz(); cpu_time_used += cpu_time_per_batch[rules_batch_idx]; - start_batch = rte_rdtsc(); + start_batch = rte_get_timer_cycles(); } } @@ -1089,7 +1089,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) if (flow_group > 0 && core_id == 0) rules_count_per_core++; - start_batch = rte_rdtsc(); + start_batch = rte_get_timer_cycles(); for (i = 0; i < (uint32_t) rules_count_per_core; i++) { if (flows_list[i] == 0) break; @@ -1107,12 +1107,12 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) * for this batch. */ if (!((i + 1) % rules_batch)) { - end_batch = rte_rdtsc(); + end_batch = rte_get_timer_cycles(); delta = (double) (end_batch - start_batch); rules_batch_idx = ((i + 1) / rules_batch) - 1; - cpu_time_per_batch[rules_batch_idx] = delta / rte_get_tsc_hz(); + cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz(); cpu_time_used += cpu_time_per_batch[rules_batch_idx]; - start_batch = rte_rdtsc(); + start_batch = rte_get_timer_cycles(); } } @@ -1185,7 +1185,7 @@ insert_flows(int port_id, uint8_t core_id) flows_list[flow_index++] = flow; } - start_batch = rte_rdtsc(); + start_batch = rte_get_timer_cycles(); for (counter = start_counter; counter < end_counter; counter++) { flow = generate_flow(port_id, flow_group, flow_attrs, flow_items, flow_actions, @@ -1211,12 +1211,12 @@ insert_flows(int port_id, uint8_t core_id) * for this batch. */ if (!((counter + 1) % rules_batch)) { - end_batch = rte_rdtsc(); + end_batch = rte_get_timer_cycles(); delta = (double) (end_batch - start_batch); rules_batch_idx = ((counter + 1) / rules_batch) - 1; - cpu_time_per_batch[rules_batch_idx] = delta / rte_get_tsc_hz(); + cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz(); cpu_time_used += cpu_time_per_batch[rules_batch_idx]; - start_batch = rte_rdtsc(); + start_batch = rte_get_timer_cycles(); } }