[RFC PATCH 2/4] eal: allow applications to report their cpu utilization
Stephen Hemminger
stephen at networkplumber.org
Wed Nov 23 17:38:36 CET 2022
On Wed, 23 Nov 2022 11:19:29 +0100
Robin Jarry <rjarry at redhat.com> 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.
More information about the dev
mailing list