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 B2F78A0540; Tue, 13 Dec 2022 18:45:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F6FC40395; Tue, 13 Dec 2022 18:45:17 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 28FF54021D for ; Tue, 13 Dec 2022 18:45:16 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1C31B20B8775; Tue, 13 Dec 2022 09:45:15 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1C31B20B8775 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1670953515; bh=sgeyfaAZXLrYtcZbljNuO9EhsRIlTADqkgrjJP0ghaY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qNjzGfjvln2OOm7CUGk2gdA6QHubuMPpHD8RPwu9GxgcxKv2Q+GXq0a8792aL0Y01 DiiXRt1UkI+8Ltc3U39MmCIWQEtDfWmjnYsU9qeA1VD35/fyAzwUNRm/SV61bgMOdD /CelrYksuYXkSmtSCKz5yDGIgkChhX++Mr8KtIz0= Date: Tue, 13 Dec 2022 09:45:15 -0800 From: Tyler Retzlaff To: Robin Jarry Cc: dev@dpdk.org, Morten =?iso-8859-1?Q?Br=F8rup?= , Kevin Laatz Subject: Re: [PATCH 2/4] eal: allow applications to report their cpu usage Message-ID: <20221213174515.GB8640@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20221123102612.1688865-1-rjarry@redhat.com> <20221207162124.769994-1-rjarry@redhat.com> <20221207162124.769994-3-rjarry@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Tue, Dec 13, 2022 at 04:49:31PM +0100, Robin Jarry wrote: > Robin Jarry, Dec 07, 2022 at 17:21: > > Allow applications to register a callback that will be invoked in > > rte_lcore_dump() and when requesting lcore info in the telemetry API. > > > > The callback is expected to return the number of TSC cycles that have > > passed since application start and the number of these cycles that were > > spent doing busy work. > > > > Signed-off-by: Robin Jarry > > Acked-by: Morten Brørup > > --- > > v3 -> v4: Changed nomenclature: CPU cycles -> TSC cycles > > As you may have noticed, I forgot to add -v4 for that iteration... > > > diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h > > index 6938c3fd7b81..df7f0a8e07c6 100644 > > --- a/lib/eal/include/rte_lcore.h > > +++ b/lib/eal/include/rte_lcore.h > > @@ -328,6 +328,35 @@ typedef int (*rte_lcore_iterate_cb)(unsigned int lcore_id, void *arg); > > int > > rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg); > > > > +/** > > + * Callback to allow applications to report CPU usage. > > + * > > + * @param [in] lcore_id > > + * The lcore to consider. > > + * @param [out] busy_cycles > > + * The amount of busy time since application start, in TSC cycles. > > + * @param [out] total_cycles > > + * The total amount of time since application start, in TSC cycles. > > + * @return > > + * - 0 if both busy and total were set correctly. > > + * - a negative value if the information is not available or if any error occurred. > > + */ > > +typedef int (*rte_lcore_usage_cb)( > > + unsigned int lcore_id, uint64_t *busy_cycles, uint64_t *total_cycles); > > Instead of two uint64_t pointers, I was thinking a better approach would > be to pass a pointer to a struct containing these two fields. That way > it leaves room for adding more counters if need be. And do so without > breaking the ABI. > > Thoughts? yes, please.