From: <jiang.kun2@zte.com.cn>
To: <bsingharora@gmail.com>, <akpm@linux-foundation.org>, <david@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-doc@vger.kernel.org>, <wang.yong12@zte.com.cn>,
<wang.yaxin@zte.com.cn>, <fan.yu9@zte.com.cn>,
<he.peilin@zte.com.cn>, <tu.qiang35@zte.com.cn>,
<qiu.yutan@zte.com.cn>, <zhang.yunkai@zte.com.cn>,
<ye.xingchen@zte.com.cn>, <xu.xin16@zte.com.cn>
Subject: [PATCH linux next] getdelays: fix error format characters
Date: Sat, 8 Feb 2025 14:44:00 +0800 (CST) [thread overview]
Message-ID: <20250208144400544RduNRhwIpT3m2JyRBqskZ@zte.com.cn> (raw)
From: Wang Yaxin <wang.yaxin@zte.com.cn>
The getdelays had a compilation issue because the format string
was not updated when the "delay min" was added. For example,
after adding the "delay min" in printf, there were 7 strings
but only 6 "%s" format specifiers. Similarly, after adding
the 't->cpu_delay_total', there were 7 variables but only
6 format characters specifiers, causing compilation issues
as follows. This commit fixes these issues to ensure that
getdelays compiles correctly.
root@xx:~/linux-next/tools/accounting$ make
getdelays.c:199:9: warning: format ‘%llu’ expects argument of type
‘long long unsigned int’, but argument 8 has type ‘char *’ [-Wformat=]
199 | printf("\n\nCPU %15s%15s%15s%15s%15s%15s\n"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.....
216 | "delay total", "delay average", "delay max", "delay min",
| ~~~~~~~~~~~
| |
| char *
getdelays.c:200:21: note: format string is defined here
200 | " %15llu%15llu%15llu%15llu%15.3fms%13.6fms\n"
| ~~~~~^
| |
| long long unsigned int
| %15s
getdelays.c:199:9: warning: format ‘%f’ expects argument of type
‘double’, but argument 12 has type ‘long long unsigned int’ [-Wformat=]
199 | printf("\n\nCPU %15s%15s%15s%15s%15s%15s\n"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.....
220 | (unsigned long long)t->cpu_delay_total,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long long unsigned int
.....
Fixes: 0c3576943441 ("delayacct: add delay min to record delay peak")
Signed-off-by: Wang Yaxin <wang.yaxin@zte.com.cn>
Signed-off-by: Kun Jiang <jiang.kun2@zte.com.cn>
Reviewed-by: xu xin <xu.xin16@zte.com.cn>
---
tools/accounting/getdelays.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c
index 100ad3dc091a..3feac0482fe9 100644
--- a/tools/accounting/getdelays.c
+++ b/tools/accounting/getdelays.c
@@ -196,22 +196,22 @@ static int get_family_id(int sd)
static void print_delayacct(struct taskstats *t)
{
- printf("\n\nCPU %15s%15s%15s%15s%15s%15s\n"
- " %15llu%15llu%15llu%15llu%15.3fms%13.6fms\n"
- "IO %15s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n"
- "SWAP %15s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n"
- "RECLAIM %12s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n"
- "THRASHING%12s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n"
- "COMPACT %12s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n"
- "WPCOPY %12s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n"
- "IRQ %15s%15s%15s%15s\n"
- " %15llu%15llu%15.3fms%13.6fms\n",
+ printf("\n\nCPU %15s%15s%15s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "IO %15s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "SWAP %15s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "RECLAIM %12s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "THRASHING%12s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "COMPACT %12s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "WPCOPY %12s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
+ "IRQ %15s%15s%15s%15s%15s\n"
+ " %15llu%15llu%15.3fms%13.6fms%13.6fms\n",
"count", "real total", "virtual total",
"delay total", "delay average", "delay max", "delay min",
(unsigned long long)t->cpu_count,
--
2.25.1
reply other threads:[~2025-02-08 6:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250208144400544RduNRhwIpT3m2JyRBqskZ@zte.com.cn \
--to=jiang.kun2@zte.com.cn \
--cc=akpm@linux-foundation.org \
--cc=bsingharora@gmail.com \
--cc=david@redhat.com \
--cc=fan.yu9@zte.com.cn \
--cc=he.peilin@zte.com.cn \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=qiu.yutan@zte.com.cn \
--cc=tu.qiang35@zte.com.cn \
--cc=wang.yaxin@zte.com.cn \
--cc=wang.yong12@zte.com.cn \
--cc=xu.xin16@zte.com.cn \
--cc=ye.xingchen@zte.com.cn \
--cc=zhang.yunkai@zte.com.cn \
/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