Skip to content

Commit 2272dbc

Browse files
Wang Yaxinakpm00
authored andcommitted
getdelays: fix error format characters
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 ..... Link: https://lkml.kernel.org/r/[email protected] Fixes: f65c64f ("delayacct: add delay min to record delay peak") Reviewed-by: xu xin <[email protected]> Signed-off-by: Wang Yaxin <[email protected]> Signed-off-by: Kun Jiang <[email protected]> Cc: Balbir Singh <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Fan Yu <[email protected]> Cc: Peilin He <[email protected]> Cc: Qiang Tu <[email protected]> Cc: wangyong <[email protected]> Cc: ye xingchen <[email protected]> Cc: Yunkai Zhang <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 41cddf8 commit 2272dbc

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tools/accounting/getdelays.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,22 @@ static int get_family_id(int sd)
196196

197197
static void print_delayacct(struct taskstats *t)
198198
{
199-
printf("\n\nCPU %15s%15s%15s%15s%15s%15s\n"
200-
" %15llu%15llu%15llu%15llu%15.3fms%13.6fms\n"
201-
"IO %15s%15s%15s%15s\n"
202-
" %15llu%15llu%15.3fms%13.6fms\n"
203-
"SWAP %15s%15s%15s%15s\n"
204-
" %15llu%15llu%15.3fms%13.6fms\n"
205-
"RECLAIM %12s%15s%15s%15s\n"
206-
" %15llu%15llu%15.3fms%13.6fms\n"
207-
"THRASHING%12s%15s%15s%15s\n"
208-
" %15llu%15llu%15.3fms%13.6fms\n"
209-
"COMPACT %12s%15s%15s%15s\n"
210-
" %15llu%15llu%15.3fms%13.6fms\n"
211-
"WPCOPY %12s%15s%15s%15s\n"
212-
" %15llu%15llu%15.3fms%13.6fms\n"
213-
"IRQ %15s%15s%15s%15s\n"
214-
" %15llu%15llu%15.3fms%13.6fms\n",
199+
printf("\n\nCPU %15s%15s%15s%15s%15s%15s%15s\n"
200+
" %15llu%15llu%15llu%15llu%15.3fms%13.6fms%13.6fms\n"
201+
"IO %15s%15s%15s%15s%15s\n"
202+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
203+
"SWAP %15s%15s%15s%15s%15s\n"
204+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
205+
"RECLAIM %12s%15s%15s%15s%15s\n"
206+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
207+
"THRASHING%12s%15s%15s%15s%15s\n"
208+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
209+
"COMPACT %12s%15s%15s%15s%15s\n"
210+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
211+
"WPCOPY %12s%15s%15s%15s%15s\n"
212+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n"
213+
"IRQ %15s%15s%15s%15s%15s\n"
214+
" %15llu%15llu%15.3fms%13.6fms%13.6fms\n",
215215
"count", "real total", "virtual total",
216216
"delay total", "delay average", "delay max", "delay min",
217217
(unsigned long long)t->cpu_count,

0 commit comments

Comments
 (0)