]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tools/power turbostat: Fix column printing for PMT xtal_time counters
authorPatryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Wed, 7 Aug 2024 11:43:39 +0000 (13:43 +0200)
committerLen Brown <len.brown@intel.com>
Sat, 30 Nov 2024 21:42:06 +0000 (16:42 -0500)
If the very first printed column was for a PMT counter of type xtal_time
we would misalign the column header, because we were always printing the
delimiter.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c

index 00674f7abdf54cce93f361ad0a09226c7970fdf1..80ac406383071361979b94f2fc3e35758c847f0b 100644 (file)
@@ -2291,7 +2291,7 @@ void print_header(char *delim)
                        break;
 
                case PMT_TYPE_XTAL_TIME:
-                       outp += sprintf(outp, "%s%s", delim, ppmt->name);
+                       outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), ppmt->name);
                        break;
                }
 
@@ -2365,7 +2365,7 @@ void print_header(char *delim)
                        break;
 
                case PMT_TYPE_XTAL_TIME:
-                       outp += sprintf(outp, "%s%s", delim, ppmt->name);
+                       outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), ppmt->name);
                        break;
                }
 
@@ -2496,7 +2496,7 @@ void print_header(char *delim)
                        break;
 
                case PMT_TYPE_XTAL_TIME:
-                       outp += sprintf(outp, "%s%s", delim, ppmt->name);
+                       outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), ppmt->name);
                        break;
                }