Commit fecb3bc8 authored by David Arcari's avatar David Arcari Committed by Len Brown

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: default avatarDavid Arcari <darcari@redhat.com>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent b88cad57
...@@ -3682,6 +3682,20 @@ int has_config_tdp(unsigned int family, unsigned int model) ...@@ -3682,6 +3682,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 static void
dump_cstate_pstate_config_info(unsigned int family, unsigned int model) dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
{ {
...@@ -3764,6 +3778,8 @@ dump_sysfs_cstate_config(void) ...@@ -3764,6 +3778,8 @@ dump_sysfs_cstate_config(void)
*sp = '\0'; *sp = '\0';
fclose(input); fclose(input);
remove_underbar(name_buf);
sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc", sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/desc",
base_cpu, state); base_cpu, state);
input = fopen(path, "r"); input = fopen(path, "r");
...@@ -5830,6 +5846,8 @@ void probe_sysfs(void) ...@@ -5830,6 +5846,8 @@ void probe_sysfs(void)
*sp = '%'; *sp = '%';
*(sp + 1) = '\0'; *(sp + 1) = '\0';
remove_underbar(name_buf);
fclose(input); fclose(input);
sprintf(path, "cpuidle/state%d/time", state); sprintf(path, "cpuidle/state%d/time", state);
...@@ -5857,6 +5875,8 @@ void probe_sysfs(void) ...@@ -5857,6 +5875,8 @@ void probe_sysfs(void)
*sp = '\0'; *sp = '\0';
fclose(input); fclose(input);
remove_underbar(name_buf);
sprintf(path, "cpuidle/state%d/usage", state); sprintf(path, "cpuidle/state%d/usage", state);
if (is_deferred_skip(name_buf)) if (is_deferred_skip(name_buf))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment