Commit abdcbdb2 authored by Len Brown's avatar Len Brown

tools/power turbostat: Print cpuidle information

Print cpuidle driver and governor.
Originally-by: default avatarAntti Laakso <antti.laakso@linux.intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent fcaa681c
...@@ -3503,6 +3503,23 @@ dump_cstate_pstate_config_info(unsigned int family, unsigned int model) ...@@ -3503,6 +3503,23 @@ dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
dump_nhm_cst_cfg(); dump_nhm_cst_cfg();
} }
static void dump_sysfs_file(char *path)
{
FILE *input;
char cpuidle_buf[64];
input = fopen(path, "r");
if (input == NULL) {
if (debug)
fprintf(outf, "NSFOD %s\n", path);
return;
}
if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input))
err(1, "%s: failed to read file", path);
fclose(input);
fprintf(outf, "%s: %s", strrchr(path, '/') + 1, cpuidle_buf);
}
static void static void
dump_sysfs_cstate_config(void) dump_sysfs_cstate_config(void)
{ {
...@@ -3516,6 +3533,15 @@ dump_sysfs_cstate_config(void) ...@@ -3516,6 +3533,15 @@ dump_sysfs_cstate_config(void)
if (!DO_BIC(BIC_sysfs)) if (!DO_BIC(BIC_sysfs))
return; return;
if (access("/sys/devices/system/cpu/cpuidle", R_OK)) {
fprintf(outf, "cpuidle not loaded\n");
return;
}
dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_driver");
dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor");
dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor_ro");
for (state = 0; state < 10; ++state) { for (state = 0; state < 10; ++state) {
sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",
......
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