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 2163CA0540; Tue, 13 Dec 2022 16:49:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECED040146; Tue, 13 Dec 2022 16:49:38 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 85B11400D5 for ; Tue, 13 Dec 2022 16:49:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670946577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xwkVzm/o0unUbBLGK9/Tvpezb0aDhbu3YnZamf0GsxU=; b=MVsiJo3pibzS0yG6WoL5AtzKkINo0xDipkVt9lv/gNfQrIX4jEx10MpiS1+5LHBj9o43SV YxySKQhBhsBQ/L3NJTFFkFLLHqkmVmEMZMt2Kna2EQj0FxQ3nkrxJtrdwUo23XJ7uA5RPk LdZ69ioI2grMSDR3j9EIzp5F/surdzE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-588-AyC3GlKcNfCSvfVnFqjzvw-1; Tue, 13 Dec 2022 10:49:34 -0500 X-MC-Unique: AyC3GlKcNfCSvfVnFqjzvw-1 Received: by mail-wm1-f71.google.com with SMTP id x10-20020a05600c420a00b003cfa33f2e7cso5022044wmh.2 for ; Tue, 13 Dec 2022 07:49:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=bCqoLomDUAakMQ5hGYa7KRdzzHJ7YhRVMuYql/bttK4=; b=FH/rXUKqMRQldW7QlBdrUv26QAG37eNiK6LPU1kiK+BjEPrjkHOBWufkwap8HE8VYg M1WqyW5rRlNRYWgFLZGtC42qvVVhrdFFFpoWLZZjsb7+sTK1TZ+F4LNM14y2a7gUcGKP LyWQMOS2vTs5e56mpsDDACYyWaXd/LKtOsQGev+W373r6vPfUSuaOzecw4+mRKcAms0J X3agHVHmA75eh96R1uVZzoYbJW11TA+Bp8ELTt+0qU6Pyin6RthkC7x9QVABuQdw0rm8 NqK+tF5/QI7NA/aQvE/yBggnBfTjZ15IYVlLqud6oU43OWJsvzRXZ3Ay1UppLFOfcE0K 84Vg== X-Gm-Message-State: ANoB5pn89SQmG24HmgVI8SEUtwvqpqB9NZqN1TKBmhPMyqmD59qfF6Fu k0CNWpGn9/NivmlLH8Q0YKM78bYLJAD4l2Jq+v4fANDb7dYW+EJKj1AhL5ACZgtwaedcirFkJGY N8BigsRSLtR6XJ/+f0wVCQCeA+LtD11a4XhozgKrpGBzhiJuBFLf3 X-Received: by 2002:a05:600c:4f16:b0:3c6:e62e:2e67 with SMTP id l22-20020a05600c4f1600b003c6e62e2e67mr16195879wmq.2.1670946572710; Tue, 13 Dec 2022 07:49:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf5w6A/hXlIteHVRNY4uglNrRPKWdbLhhr2FFopZzM7JmiIdP4XM37sgTK2t286RZqk+bdNiWA== X-Received: by 2002:a05:600c:4f16:b0:3c6:e62e:2e67 with SMTP id l22-20020a05600c4f1600b003c6e62e2e67mr16195865wmq.2.1670946572488; Tue, 13 Dec 2022 07:49:32 -0800 (PST) Received: from localhost (2a01cb000f483e0055ae3800781b5cbc.ipv6.abo.wanadoo.fr. [2a01:cb00:f48:3e00:55ae:3800:781b:5cbc]) by smtp.gmail.com with ESMTPSA id q184-20020a1c43c1000000b003b4fdbb6319sm13412547wma.21.2022.12.13.07.49.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Dec 2022 07:49:32 -0800 (PST) Mime-Version: 1.0 Date: Tue, 13 Dec 2022 16:49:31 +0100 Message-Id: Cc: =?utf-8?q?Morten_Br=C3=B8rup?= , "Kevin Laatz" Subject: Re: [PATCH 2/4] eal: allow applications to report their cpu usage From: "Robin Jarry" To: X-Mailer: aerc/0.13.0-132-g8dea6c9102ea References: <20221123102612.1688865-1-rjarry@redhat.com> <20221207162124.769994-1-rjarry@redhat.com> <20221207162124.769994-3-rjarry@redhat.com> In-Reply-To: <20221207162124.769994-3-rjarry@redhat.com> X-Mimecast-Spam-Score: 1 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 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 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=C3=B8rup > --- > 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 lco= re_id, void *arg); > int > rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg); > =20 > +/** > + * 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 er= ror occurred. > + */ > +typedef int (*rte_lcore_usage_cb)( > +=09unsigned 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?