[PATCH v2] eal: support lcore usage ratio
Morten Brørup
mb at smartsharesystems.com
Mon Oct 23 14:42:00 CEST 2023
> From: Chengwen Feng [mailto:fengchengwen at huawei.com]
> Sent: Monday, 23 October 2023 14.29
>
> Current, the lcore usage only display two key fields: busy_cycles and
> total_cycles, which is inconvenient to obtain the usage ratio
> immediately. So adds lcore usage ratio field.
[...]
> @@ -462,8 +469,9 @@ lcore_dump_cb(unsigned int lcore_id, void *arg)
> /* Guard against concurrent modification of lcore_usage_cb. */
> usage_cb = lcore_usage_cb;
> if (usage_cb != NULL && usage_cb(lcore_id, &usage) == 0) {
> - if (asprintf(&usage_str, ", busy cycles %"PRIu64"/%"PRIu64,
> - usage.busy_cycles, usage.total_cycles) < 0) {
> + if (asprintf(&usage_str, ", busy cycles %"PRIu64"/%"PRIu64"
> (ratio %.2f%%)",
The zero is missing in %.02f%%.
> + usage.busy_cycles, usage.total_cycles,
> + calc_usage_ratio(&usage)) < 0) {
> return -ENOMEM;
> }
> }
> @@ -511,11 +519,19 @@ struct lcore_telemetry_info {
> struct rte_tel_data *d;
> };
>
> +static void
> +format_usage_ratio(char *buf, uint16_t size, const struct
> rte_lcore_usage *usage)
> +{
> + float ratio = calc_usage_ratio(usage);
> + snprintf(buf, size, "%.2f%%", ratio);
Also zero missing in "%.02f%%" here.
With the two missing zeroes added,
Acked-by: Morten Brørup <mb at smartsharesystems.com>
More information about the dev
mailing list