From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C60A2A0542; Wed, 5 Oct 2022 11:20:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E2D0427EE; Wed, 5 Oct 2022 11:20:09 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2065.outbound.protection.outlook.com [40.107.247.65]) by mails.dpdk.org (Postfix) with ESMTP id 3C46D40694 for ; Wed, 5 Oct 2022 11:20:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIBS3FJab1dKwphwNe44/5dfFoo6xOs58+rlEDyLmANIQ8R97H+eg+62e826yobrrwZFR7Olz64C79xcLFmXL+E66vDJfDE1AsckFtON1mxUNgdF3SlcddyiDXOCi/VJPPD/5VXLMkOX8/yA96e++5LGUVBvbqibx2f1SNwjQ5zxcRBRjsedMvGLVrRcQiSASvpj54gLrt8Ne6VDMU0ENOzOPx/GoNOX8sl9LDFawPYdmsLjGMpQVllJpCJn3HApESq6YGTVxNInX6ZRRAp5I2Is0udOj38IpS6VimUhyTWmnm9hR8QLl9bj3D/S4XJphX0KvRrdBjP+jOGiWFIeKg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AmOmowWToL5H4fyzescauGMW6KgkQznb3QYfIQnxuks=; b=O8ppIbTWcFiK2/cl9tPCmOd4Jx2CvRXnT48g2BaEOoQx9NAlGzMwnjVHksSkocaPfrCAEvtP1yuiZBc2p+JanPNvtTf2povIJ775SEAFm7NFZTkRi0nBule8qV96W7gOBb6213yF3mTCpB9c6vNK8M9eIi6t1pCB7BnRxhnU0pse05jeEgB4cM1FaqX+ULXbZlKbmaLGz/EBca0A3DRwQbl6JKK/peGu1wBLMgYW9HapRZSp1qUtPnac3Qg0c1oAQlwAIfqjh5KlbqYwpLD5W1Id91yxI2XynkqIcYu6V/ElpyjF/PB1mmd2JAxyQLh+4YcqEE5JSLYFcstrQqX3Dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AmOmowWToL5H4fyzescauGMW6KgkQznb3QYfIQnxuks=; b=hJBro/pHxslynNLBMYEydT1GHzoXSkEZeD2euSHHGNCXhGZG9FgsFn826bZo2pIz7iyfVpCtKZYef4sm3C8RBnki/V+sJv0qrxXVROxffTjuQo5cvyd1ym7NfW7Nfn6vJ0+bbocQU8n8QnSnHF2t6yQXOGxpfu/xWW0j8fuUY84= Received: from AS9PR06CA0762.eurprd06.prod.outlook.com (2603:10a6:20b:484::20) by AS8PR07MB7367.eurprd07.prod.outlook.com (2603:10a6:20b:2a2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.10; Wed, 5 Oct 2022 09:20:06 +0000 Received: from AM5EUR02FT069.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:484:cafe::88) by AS9PR06CA0762.outlook.office365.com (2603:10a6:20b:484::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.26 via Frontend Transport; Wed, 5 Oct 2022 09:20:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT069.mail.protection.outlook.com (10.152.8.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5709.10 via Frontend Transport; Wed, 5 Oct 2022 09:20:05 +0000 Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESSMR502.ericsson.se (153.88.183.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Wed, 5 Oct 2022 11:20:03 +0200 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.192) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Wed, 5 Oct 2022 11:20:03 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id 95B2A1C006B; Wed, 5 Oct 2022 11:20:03 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?UTF-8?q?Morten=20Br=C3=B8rup?= , nd , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH v2 2/6] service: introduce per-lcore cycles counter Date: Wed, 5 Oct 2022 11:16:11 +0200 Message-ID: <20221005091615.94652-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005091615.94652-1-mattias.ronnblom@ericsson.com> References: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> <20221005091615.94652-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM5EUR02FT069:EE_|AS8PR07MB7367:EE_ X-MS-Office365-Filtering-Correlation-Id: 39ab0699-8061-4340-03f1-08daa6b2ca9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OIjt3MwhnpEsa5Zwberam1Swt6umRC7jUDEO3OKMPOU3fk16anyM2YeUc+OWUD1D6wZG9IqRLHhcgj1Gt3MV8cZKUORnvpPcwoCPSW5+nejR1tfqSt6opy+cB5d6JwO3J2fdZOGIeP20sFFUZsEnYtt0kU3sRPAf/pTcrQBjaQdr7n+CzvP1iCXv9Il3MygDaHIsehH/wtc0XVSpaEED1oil5igDnqVw2KudSUsE8dnK72vIAjEamtp//toYJXoQ42sOiazxv97KEk19/W6xlC3fmPxiwvA0+dMxc+sJeUefpO6QwjqsozPdoM/wwsrdnHkw7EsjctXdHatfZeZcl6b0xCPhH2cOa5USDpt8Em6eiP/I3FhknpAlJG0/WKXTbgVKp5f7n1/MWrJ/IwJ/lewkv2wufpYGiZW2lXc3Y0C6U7tXMFILJR/DguMdCnVHxa4uChZkPzDzN7DQlHdVX0GOLaCePloh4u08N+ohLYV3sxkLjXdmM1L6x5waTsEOE0wUDACptCUwGJeKClLtdf5+Sx/sH0heGfD0/WJKkURdiWlgwjyP714wvILAV7SKkO3ni1j1JTnmRxL07qaWuS8+mLuI8mLZlZ9CcbNDigIIv4JDZ2KIaMD9tipeZkvqOxrTltgmZnjNbo9pgAg1AmchwhkakkpYclUKkzZxHopw9y+xNw1Vg9TvVg3wqgFewtJ7byFT6HCJZWW/j77/2IP+MZbMpt9fBYjKwj6CUFmp4NDCgmvF7F9kb7d/meHaO70FKkKLBLYi3G/NxuigIyYtc5E1/MUEqYcteHqkhx1xHWXo091SJlApbPpwFLY3 X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199015)(46966006)(36840700001)(40470700004)(107886003)(7636003)(6666004)(41300700001)(8676002)(82310400005)(70586007)(70206006)(83380400001)(2906002)(356005)(2616005)(40460700003)(1076003)(66574015)(47076005)(186003)(82740400003)(82960400001)(4326008)(8936002)(36756003)(36860700001)(336012)(6266002)(5660300002)(26005)(40480700001)(86362001)(478600001)(316002)(54906003)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2022 09:20:05.9398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39ab0699-8061-4340-03f1-08daa6b2ca9d X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT069.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7367 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 Introduce a per-lcore counter for the total time spent on processing services on that core. This counter is useful when measuring individual lcore load. Signed-off-by: Mattias Rönnblom --- app/test/test_service_cores.c | 2 +- lib/eal/common/rte_service.c | 15 +++++++++++++++ lib/eal/include/rte_service.h | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index 7415b6b686..096405133b 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -403,7 +403,7 @@ service_lcore_attr_get(void) "lcore_attr_get() failed to get loops " "(expected > zero)"); - lcore_attr_id++; // invalid lcore attr id + lcore_attr_id = 42; /* invalid lcore attr id */ TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_attr_get(slcore_id, lcore_attr_id, &lcore_attr_value), "Invalid lcore attr didn't return -EINVAL"); diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c index 6b807afacf..4d51de638d 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -66,6 +66,7 @@ struct core_state { uint8_t is_service_core; /* set if core is currently a service core */ uint8_t service_active_on_lcore[RTE_SERVICE_NUM_MAX]; uint64_t loops; + uint64_t cycles; struct service_stats service_stats[RTE_SERVICE_NUM_MAX]; } __rte_cache_aligned; @@ -376,6 +377,9 @@ service_runner_do_callback(struct rte_service_spec_impl *s, * is needed, and not the more expensive atomic * add. */ + __atomic_store_n(&cs->cycles, cs->cycles + cycles, + __ATOMIC_RELAXED); + struct service_stats *service_stats = &cs->service_stats[service_idx]; @@ -819,6 +823,14 @@ lcore_attr_get_loops(unsigned int lcore) return __atomic_load_n(&cs->loops, __ATOMIC_RELAXED); } +static uint64_t +lcore_attr_get_cycles(unsigned int lcore) +{ + struct core_state *cs = &lcore_states[lcore]; + + return __atomic_load_n(&cs->cycles, __ATOMIC_RELAXED); +} + static uint64_t lcore_attr_get_service_calls(uint32_t service_id, unsigned int lcore) { @@ -903,6 +915,9 @@ rte_service_lcore_attr_get(uint32_t lcore, uint32_t attr_id, case RTE_SERVICE_LCORE_ATTR_LOOPS: *attr_value = lcore_attr_get_loops(lcore); return 0; + case RTE_SERVICE_LCORE_ATTR_CYCLES: + *attr_value = lcore_attr_get_cycles(lcore); + return 0; default: return -EINVAL; } diff --git a/lib/eal/include/rte_service.h b/lib/eal/include/rte_service.h index 35d8018684..70deb6e53a 100644 --- a/lib/eal/include/rte_service.h +++ b/lib/eal/include/rte_service.h @@ -407,6 +407,12 @@ int32_t rte_service_attr_reset_all(uint32_t id); */ #define RTE_SERVICE_LCORE_ATTR_LOOPS 0 +/** + * Returns the total number of cycles that the lcore has spent on + * running services. + */ +#define RTE_SERVICE_LCORE_ATTR_CYCLES 1 + /** * Get an attribute from a service core. * -- 2.34.1