From patchwork Wed Mar 10 13:55:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wisam Monther X-Patchwork-Id: 88876 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 5420CA0567; Wed, 10 Mar 2021 14:56:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 619C022A67A; Wed, 10 Mar 2021 14:56:05 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) by mails.dpdk.org (Postfix) with ESMTP id 000EF22A668 for ; Wed, 10 Mar 2021 14:56:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZSxMMAwuPxkVL7hBUF14WSnYt7Mkcs9FO21SmMp9Kiis6YkZW6LG2jsqQmPR/aoa1Aon/fCnr/EiYSduzGTjdX8BCi7K5vem1vtra3wrrZj8TQRzRAqoJ+GxFLV/VqFvgqDsN9WBc825sGXF5tu71PtVVpkRjUdHUYJMtvM2rKq5s1AiHPJzwK99YEOHZjGw7hDbeQuBZ3l6S7RsGpnUnb/S9ctAlcEejWNqBLZFkfFCGictfq3trvip/Voiv0BPkdqsNuPrVDh4HB8ULENLwQp5bZqtWAb0I/wsEvDTNOMWm/UwmOO9mE/HAwr6vXZURJ8FQgMAjXTyuzn4f3vqw== 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=LbgZX6nV/dEgSWfAOa8ameUm0p1tFFPwukQj5T9O2wzC3DdwPNHhCPzPHVwBlXJ3/+qX2OPemzPr7TkwqOw+t5nUckCLJELfT9x5FDdoq9fazeiOf5zuteq35s5qeQyqZuBkwzkagcovQ99h67sXvgY4hKRMaA3/0yNaxzGkFEBOy6TPRBqP4A0lWR4yBB0KfWp1omtGQhf+IEYmh1rfid1iG3r/d5xLPUXne2+k5H1Z1D3KWHEGmLV1m8oWVSUxWY0Z4TBBbVl1o61PzrqHXAleNa6W7QtYQj9mwi7y7D0wjBLdtnJIJzQEC3EHIiW/B/9Ou7c+gHO/mYLOfm9O0A== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kHzuYpqhDFPLbS8TFa0kQ2R70un0RICthcjLlHQinYQ=; b=cqEls01cmjP9PpLBA7NgK+kuKYjuvahfrsl8IWo/fRkcvlIt4UT0r2e6IjYFYXU2XRqlVSuQTmSJH5/XVLYrO5e4hnhh+VSTHUiAxc91Lb2XNvvUj5XQOQrDGhBpdnumiXM5xhZ5aeXOfM16Lj6PIxVSpfiWmnAW1hpIgSxFYYxklPMO26qAXMn7yBE42J8WRCgxAXAxnBoAOYV1SoyVTPIbsLgFh2DNntf5FP8hZophTaQc8amD0hTsu57CjI6C4FmONHMHfSsNCdWwFFO4O6dwnoi3kMX4D6eiCzLLUAxfXEqjQdl83OZifRvG5MoQSP4rpMH11RtsEbikyUTNZA== Received: from BN6PR19CA0078.namprd19.prod.outlook.com (2603:10b6:404:133::16) by MN2PR12MB3181.namprd12.prod.outlook.com (2603:10b6:208:ae::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.19; Wed, 10 Mar 2021 13:56:02 +0000 Received: from BN8NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:404:133:cafe::cb) by BN6PR19CA0078.outlook.office365.com (2603:10b6:404:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Wed, 10 Mar 2021 13:56:02 +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 BN8NAM11FT019.mail.protection.outlook.com (10.13.176.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3933.31 via Frontend Transport; Wed, 10 Mar 2021 13:56:01 +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; Wed, 10 Mar 2021 13:55:59 +0000 From: Wisam Jaddo To: , , , , Date: Wed, 10 Mar 2021 15:55:40 +0200 Message-ID: <20210310135546.8680-2-wisamm@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210310135546.8680-1-wisamm@nvidia.com> References: <20210310134858.8104-2-wisamm@nvidia.com> <20210310135546.8680-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: 7a504ddd-c3a3-4a69-943e-08d8e3cc3dac X-MS-TrafficTypeDiagnostic: MN2PR12MB3181: 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: BF5FbcuKx5xC6yqqSfms/Yvnax7N1oGmweF/tLyvt57Ky/Fgkbj4ZF+nG37l5Z+eJqXw3kbsJV3qd1Rq/GFdxkJdLdO1mKYke1Omkhx7I9mBfENM/7TxqUTXnpGzaaRWtJi+NerCwfr9MhnV3lBZjkAoNHQ///XmrLzBCwAD5gTWysHDsVnfKngKpmjTobpQM0T2mJc+wytcwLql5Vb/dPd72tTy0mRRKGx2bnf7KU9/sREPlhbSbHVMO6eLF9X6IFk2VI4l+7W/e24LuNTx58jHwBcAjylvqjGpRT2hPC4xz0d6DhPxeFXiR/kSxht/yFOwaKJgp4n5mnfnLbL0p7t0K9XlBq4am9vLDEBJqr9iu0EQtokYdiG3XEZ6aR7hiNkYTgI1zEwzLzVy6vJD1DAExH+JdHxb5wecexi39m6jXngU9z0NVVm0UObCWW7HmEWH7b5D2d15nMqHjc4HlJxZ8hz1OU28tqaPoI+bJ+JQaSwxa7pPye+I2YpH47IshIzZ2Ovw3gPH2tzG9ImXpu/QPe+CP1RRD4IjR3G0PbVBvFA8AoPJXQPphmn+pHbomCXfgB88HVRSeXbtiP1nu1N3p4NZ47czUTah4HW49dmob1EaoY2GRn/BSaEQ4PrGDnII0de2eVY2qqfHvG2gcgw+F4NzsGEu9PMgoKf/aNRRLpej0VwFBxRVftfpIhSv9VjXNN1SAaCB5+0CBihRmw== 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)(136003)(376002)(39860400002)(36840700001)(46966006)(82310400003)(36906005)(83380400001)(34020700004)(7696005)(26005)(110136005)(36860700001)(36756003)(6286002)(186003)(47076005)(316002)(478600001)(2906002)(6666004)(5660300002)(356005)(1076003)(70586007)(7636003)(16526019)(70206006)(8936002)(336012)(82740400003)(2616005)(426003)(55016002)(86362001)(8676002)(41533002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2021 13:56:01.8939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a504ddd-c3a3-4a69-943e-08d8e3cc3dac 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: BN8NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3181 Subject: [dpdk-dev] [PATCH v3 1/7] 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(); } }