]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/power turbostat: Fix swidle header vs data display
authorLen Brown <len.brown@intel.com>
Sun, 8 Mar 2026 02:43:11 +0000 (21:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Apr 2026 11:30:34 +0000 (13:30 +0200)
[ Upstream commit b8ead30e2b2c7f32c8d2782e805160b110766592 ]

I changed my mind about displaying swidle statistics,
which are "added counters".  Recently I reverted the
column headers to 8-columns, but kept print_decimal_value()
padding out to 16-columns for all 64-bit counters.

Simplify by keeping print_decimial_value() at %lld -- which
will often fit into 8-columns, and live with the fact
that it can overflow and shift the other columns,
which continue to tab-delimited.

This is a better compromise than inserting a bunch
of space characters that most users don't like.

Fixes: 1a23ba6a1ba2 ("tools/power turbostat: Print wide names only for RAW 64-bit columns")
Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/power/x86/turbostat/turbostat.c

index 1b26d94c373fbd8e871372db92df3730edc724dc..903943d30f7131e15be62893c01d84f03acd4dba 100644 (file)
@@ -2747,10 +2747,9 @@ static inline int print_hex_value(int width, int *printed, char *delim, unsigned
 
 static inline int print_decimal_value(int width, int *printed, char *delim, unsigned long long value)
 {
-       if (width <= 32)
-               return (sprintf(outp, "%s%d", (*printed++ ? delim : ""), (unsigned int)value));
-       else
-               return (sprintf(outp, "%s%-8lld", (*printed++ ? delim : ""), value));
+       UNUSED(width);
+
+       return (sprintf(outp, "%s%lld", (*printed++ ? delim : ""), value));
 }
 
 static inline int print_float_value(int *printed, char *delim, double value)