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 B5CA2A04FD; Wed, 23 Nov 2022 17:38:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6909242D9E; Wed, 23 Nov 2022 17:38:40 +0100 (CET) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id 84B8A40E5A for ; Wed, 23 Nov 2022 17:38:39 +0100 (CET) Received: by mail-pj1-f47.google.com with SMTP id y14-20020a17090a2b4e00b002189a1b84d4so2321102pjc.2 for ; Wed, 23 Nov 2022 08:38:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=wc5w9+v0uqYXv7b9uo+ldzRSGpRLSdmFfNkB2MYyMxg=; b=qvCYGh4vCT7pPwTmL7GAtsRJZpx2wrryXTJsokXvxjtr3wGAAhmZ+QZFmwxuveN8Ug bkVm7aI0bdIZybJXAXhMDtHR9umxjV01kfmTHSybnwdv7Do0bA6tMdgD4UM/Jbo8GoXF HMijetJM1GPv7FqEVNMBaKWvZ/X/dTQisjNyje+FsHUfWHR2recpgVh46bN39H7RDhbS G6fRIF6h1k8koz26u9zdXKiHubVxqXaGUC6Y61BTU2qebSpEV5df6hF3zba3+XCrjRE4 1uokpZTz+hPyRjzb9YWD9Xwqe4CfX4b9nA++zGKHNdIzo137bcNIT9E5kfVRtVnUTmdr 0ZPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wc5w9+v0uqYXv7b9uo+ldzRSGpRLSdmFfNkB2MYyMxg=; b=flz/T+KXbsxPnRVGQ0W4j20rCmBhfxKYTna+BmbJ8ED+JyI96VcFRlarcKv4esp6Wx O3UnRohoqzOSWORMmxHbkOO6ZHNuJD1X/96dhb3wkstrftPCS2qYOiNpNsd0wrugZXRf k4PnWMr3kHh0zXPnwpkiVCAQoOE6PLkRBSEQANYq5BH/uxLbb8gfo6FAa3F8aS4HfjMO gIKIgdiROPhsb6jBVmWULKPGUCDjkS5MLHsEpnS0ClxffdnB7o4YXADeMdbTL/OUEKF9 MXPvuZOxbMAAP0IAGkrEZawT+xsf0kekCKQBcmvqiAQ0rsxkinq2aFtRZ4oaleJuZ03s OCpw== X-Gm-Message-State: ANoB5pneqtNusfIRc6ugA3f0yFJXMddaWDnmlqal7p+P0XptVjEmr68Z G4pT5BH+/GJA5nzeiwBM6N9qCA== X-Google-Smtp-Source: AA0mqf4emdpOu6htdMIKyxlxOU2+lRsrEkK9F6Rr5aNTiuyhx92MbChKSI08Dywuk1AMVko+wnqgVQ== X-Received: by 2002:a17:90b:4a8e:b0:211:17fe:a444 with SMTP id lp14-20020a17090b4a8e00b0021117fea444mr37510126pjb.210.1669221518488; Wed, 23 Nov 2022 08:38:38 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id l17-20020a170903245100b00176b84eb29asm14636622pls.301.2022.11.23.08.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 08:38:38 -0800 (PST) Date: Wed, 23 Nov 2022 08:38:36 -0800 From: Stephen Hemminger To: Robin Jarry Cc: dev@dpdk.org, Bruce Richardson , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Mattias =?UTF-8?B?UsO2bm5ibG9t?= , Morten =?UTF-8?B?QnLDuHJ1cA==?= Subject: Re: [RFC PATCH 2/4] eal: allow applications to report their cpu utilization Message-ID: <20221123083836.66c254db@hermes.local> In-Reply-To: <20221123101931.1688238-3-rjarry@redhat.com> References: <20221123101931.1688238-1-rjarry@redhat.com> <20221123101931.1688238-3-rjarry@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Wed, 23 Nov 2022 11:19:29 +0100 Robin Jarry wrote: > +static rte_lcore_busy_percent_cb lcore_busy_cb; > +static unsigned int lcore_busy_period; > + > +void > +rte_lcore_register_busy_percent_cb(rte_lcore_busy_percent_cb cb, unsigned int period) > +{ > + lcore_busy_cb = cb; > + lcore_busy_period = period; > +} > + > +static int > +lcore_busy_percent(unsigned int lcore_id) > +{ > + int percent = -1; > + if (lcore_busy_cb) > + percent = lcore_busy_cb(lcore_id); > + if (percent > 100) > + percent = 100; > + return percent; > +} This is a case where floating point double precision might be a better API.