[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200810144330.75613-1-darcari@redhat.com>
Date: Mon, 10 Aug 2020 10:43:30 -0400
From: David Arcari <darcari@...hat.com>
To: linux-pm@...r.kernel.org
Cc: David Arcari <darcari@...hat.com>, Len Brown <lenb@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] tools/power turbostat: fix output formatting for ACPI CST enumeration
turbostat formatting is broken with ACPI CST for enumeration. The
problem is that the CX_ACPI% is eight characters long which does not
work with tab formatting. One simple solution is to remove the underbar
from the state name such that C1_ACPI will be displayed as C1ACPI.
Signed-off-by: David Arcari <darcari@...hat.com>
Cc: Len Brown <lenb@...nel.org>
Cc: linux-kernel@...r.kernel.org
---
tools/power/x86/turbostat/turbostat.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 33b370865d16..5f074879cc0a 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -3474,6 +3474,20 @@ int has_config_tdp(unsigned int family, unsigned int model)
}
}
+static void
+remove_underbar(char *s)
+{
+ char *to = s;
+
+ while (*s) {
+ if (*s != '_')
+ *to++ = *s;
+ s++;
+ }
+
+ *to = 0;
+}
+
static void
dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
{
@@ -3559,6 +3573,8 @@ dump_sysfs_cstate_config(void)
*sp = '\0';
fclose(input);
+ remove_underbar(name_buf);
+
sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc",
base_cpu, state);
input = fopen(path, "r");
@@ -5597,6 +5613,8 @@ void probe_sysfs(void)
*sp = '%';
*(sp + 1) = '\0';
+ remove_underbar(name_buf);
+
fclose(input);
sprintf(path, "cpuidle/state%d/time", state);
@@ -5624,6 +5642,8 @@ void probe_sysfs(void)
*sp = '\0';
fclose(input);
+ remove_underbar(name_buf);
+
sprintf(path, "cpuidle/state%d/usage", state);
if (is_deferred_skip(name_buf))
--
2.27.0
Powered by blists - more mailing lists