DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Chengwen Feng" <fengchengwen@huawei.com>, <thomas@monjalon.net>,
	<ferruh.yigit@amd.com>
Cc: <dev@dpdk.org>
Subject: RE: [PATCH v2] eal: support lcore usage ratio
Date: Mon, 23 Oct 2023 14:42:00 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9EF6E@smartserver.smartshare.dk> (raw)
In-Reply-To: <20231023122929.54028-1-fengchengwen@huawei.com>

> From: Chengwen Feng [mailto:fengchengwen@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@smartsharesystems.com>


  reply	other threads:[~2023-10-23 12:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  4:08 [PATCH] " Chengwen Feng
2023-10-23  8:58 ` Morten Brørup
2023-10-23 12:02   ` fengchengwen
2023-10-23 12:29 ` [PATCH v2] " Chengwen Feng
2023-10-23 12:42   ` Morten Brørup [this message]
2023-10-23 12:51 ` [PATCH v3] " Chengwen Feng
2023-10-31 13:22   ` lihuisong (C)
2023-11-06 16:38   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35E9EF6E@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).