On Wed, 23 Nov 2022 11:19:29 +0100
Robin Jarry <rja...@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.

Reply via email to