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 B229AA0542; Tue, 6 Sep 2022 18:16:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE61E42829; Tue, 6 Sep 2022 18:16:37 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2051.outbound.protection.outlook.com [40.107.22.51]) by mails.dpdk.org (Postfix) with ESMTP id DC37B427F6 for ; Tue, 6 Sep 2022 18:16:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SLnnJG4toXlUK7yaXzloQ7h5pFNkKkxsbo5uWqwHcxf4/oMJLr3ttOl7+UDayRtJwyhlaTZZSXFwc52Nci0rlClOr+qZwKLb/kP17MRZ/fEX46MWW058iqLKVkls7XNy7XySbeV5ZvrFdWe+BnFBWRrgMU81Ap81/JZlIVHB2DsFyyQztA+xLmSHIti4TT8/W7aR/cew+ibVezJnDx42wXOEwCldv++elME/vxGnpelCfAYiDQrvV0+4ch1AqRbO4igR+fdYD0qIDwY1+rPWXq/00Swwv146YMjlhzRztcPtbARtZltbHo1to24xsVaW0pWAvzJggFiVDcjvtrQA7g== 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=oZ/FMY9oP1zSTckIX5lsjE8pX4fNFLPrnoDV6KD9e70=; b=iba+h5Cln2HYLvB+ftAKVSvpEBB2RS6KS8MV8xSNFm6Cla276WBiCHfTyG7hIId9cW/MAWnETqFXUZJkMVPBtBGBIScvH8vPa1F5CNsWvxOXOYibehgsp7ML+4BFNoBaeBka9CvNUXZeJKtdIleuWpNSZzIQsTkkZnj+Fcf7N6YVNjfp5buYJXbEWKN+vk/w9Q1mXvvXoppBiDVIoTExoD2SDlyLlYUJbkpwuawz7YJWfB8kPl4qGTdzL/l0heS84qYi/lJuICJfZnT1YrHuv2eXK1lXDQsdQG5SbFCUT2jgH1s7DtKwQzTICKYpHyeDVPz8dytjZqyS4p4gi1QUkQ== 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=oZ/FMY9oP1zSTckIX5lsjE8pX4fNFLPrnoDV6KD9e70=; b=dfvy+n/9q4YFC6wb9cLK6B8AE+JFFpwitV5lMDVkYuNc206HYHyk7EPIJSsbw5syWy/Z7MVWlQbWbEEnhAKivaaIoWNyQiy8sgxRSsSTUYpvj8vkRoc6z0GF1P9um72UG5UDQt6kqFgld3/GnlWqoyVc/hi/orHRuA8DuoG/U7U= Received: from GV3P280CA0037.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::20) by VI1PR07MB3982.eurprd07.prod.outlook.com (2603:10a6:803:37::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:16:30 +0000 Received: from HE1EUR02FT030.eop-EUR02.prod.protection.outlook.com (2603:10a6:150:9:cafe::d8) by GV3P280CA0037.outlook.office365.com (2603:10a6:150:9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11 via Frontend Transport; Tue, 6 Sep 2022 16:16:30 +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 HE1EUR02FT030.mail.protection.outlook.com (10.152.10.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:30 +0000 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:30 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.190) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:29 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 9B39F380061; Tue, 6 Sep 2022 18:16:29 +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 2/6] service: introduce per-lcore cycles counter Date: Tue, 6 Sep 2022 18:13:48 +0200 Message-ID: <20220906161352.296110-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> <20220906161352.296110-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-Office365-Filtering-Correlation-Id: 119c1b03-a3e4-4a4d-e0d0-08da90232858 X-MS-TrafficTypeDiagnostic: VI1PR07MB3982:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hWC9ytwG1kUlWPEvSMc2SMihMGwhY8bMNwKj6P36ENcdh9Wu4Fbwnc55gzAel3jczqOac26LT5r83mWHS7cvi+TbYivYyd+tinG9ge3ZRr9y5Aynr3YWvRkkAuXTxAiu5lKZRMJ35c+j5zzo+H4LBVvQw89Eq0F6TbftYSHle6BOfwuaYrE6zyOtMN5y86xlT7B8X1HbBdGCNfCxF2RqBN806G+1q14CSpa5MRkJbdvOsSg9gMBtn0BjXgPu3KUBFVyAao1Upsm2J2o7UPi1Z8+Ic3l1eFlAgsk5UzjGxsnCynx6MQfFb/1w7sodaiwlXDmxq+FPCsAPzBj4/UknXpM2VXBTCROokakdkOgYu3wTiAjdwqE5XUVrIctPxTDQ78pMHKNk1+kiN8kMy5SuMBnwYroe0QxdJmKCJ2hBeld93TW6K9SVxzXhb8oi/jdrOx5pWRmQsEQuQnfhNbQJm4gqV4MDLee5neg2TKJ1JfZRP3hnwdO+CzQHsCldQ+rxB+XJ2KDPZ8Pf/0l0A2iv3QdksPBB5yfhHlQoJ0NzkX804YVkZryRyCQnT2FbNTRyn44UmNuBLR0fO3LdarC1fRdzC0eFy49pvyH57le5uXhD8yGYdiAvgtBI7g2Qt+pjCR1M+xXUvGwMk/XBk58LHWQ1qwOD1r2PNvn2kyNM8TqqP2QNsGPqymQMRgvvwujCB6Fs1g16n4tC5ixgdrHK2BecxkWUioqXFv1emwBBthwZwCUwv1QVfJD0ft/FbP2CwS/aQHCcBn9AggL9MTXvLw== 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:(13230016)(4636009)(39860400002)(376002)(346002)(136003)(396003)(40470700004)(36840700001)(46966006)(8676002)(8936002)(4326008)(83380400001)(70586007)(336012)(70206006)(47076005)(66574015)(36860700001)(5660300002)(26005)(107886003)(478600001)(41300700001)(186003)(6266002)(1076003)(2616005)(6666004)(316002)(82310400005)(36756003)(54906003)(40460700003)(6916009)(86362001)(40480700001)(82740400003)(2906002)(82960400001)(356005)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB3982 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 | 14 ++++++++++++++ lib/eal/include/rte_service.h | 6 ++++++ 3 files changed, 21 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 b5103f2a20..87df04e3ac 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -61,6 +61,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; uint64_t calls_per_service[RTE_SERVICE_NUM_MAX]; uint64_t cycles_per_service[RTE_SERVICE_NUM_MAX]; } __rte_cache_aligned; @@ -372,6 +373,8 @@ 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); __atomic_store_n(&cs->calls_per_service[service_idx], cs->calls_per_service[service_idx] + 1, __ATOMIC_RELAXED); @@ -812,6 +815,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) { @@ -896,6 +907,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