Skip to content

Commit 7293fcc

Browse files
committed
tools/power turbostat: dump p-state software config
cpu1: cpufreq driver: acpi-cpufreq cpu1: cpufreq governor: ondemand cpufreq boost: 1 or cpu0: cpufreq driver: intel_pstate cpu0: cpufreq governor: powersave cpufreq intel_pstate no_turbo: 0 Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 7da6e3e commit 7293fcc

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,6 +2979,54 @@ dump_sysfs_cstate_config(void)
29792979
fclose(input);
29802980
}
29812981
}
2982+
static void
2983+
dump_sysfs_pstate_config(void)
2984+
{
2985+
char path[64];
2986+
char driver_buf[64];
2987+
char governor_buf[64];
2988+
FILE *input;
2989+
int turbo;
2990+
2991+
sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_driver",
2992+
base_cpu);
2993+
input = fopen(path, "r");
2994+
if (input == NULL) {
2995+
fprintf(stderr, "NSFOD %s\n", path);
2996+
return;
2997+
}
2998+
fgets(driver_buf, sizeof(driver_buf), input);
2999+
fclose(input);
3000+
3001+
sprintf(path, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor",
3002+
base_cpu);
3003+
input = fopen(path, "r");
3004+
if (input == NULL) {
3005+
fprintf(stderr, "NSFOD %s\n", path);
3006+
return;
3007+
}
3008+
fgets(governor_buf, sizeof(governor_buf), input);
3009+
fclose(input);
3010+
3011+
fprintf(outf, "cpu%d: cpufreq driver: %s", base_cpu, driver_buf);
3012+
fprintf(outf, "cpu%d: cpufreq governor: %s", base_cpu, governor_buf);
3013+
3014+
sprintf(path, "/sys/devices/system/cpu/cpufreq/boost");
3015+
input = fopen(path, "r");
3016+
if (input != NULL) {
3017+
fscanf(input, "%d", &turbo);
3018+
fprintf(outf, "cpufreq boost: %d\n", turbo);
3019+
fclose(input);
3020+
}
3021+
3022+
sprintf(path, "/sys/devices/system/cpu/intel_pstate/no_turbo");
3023+
input = fopen(path, "r");
3024+
if (input != NULL) {
3025+
fscanf(input, "%d", &turbo);
3026+
fprintf(outf, "cpufreq intel_pstate no_turbo: %d\n", turbo);
3027+
fclose(input);
3028+
}
3029+
}
29823030

29833031

29843032
/*
@@ -4168,6 +4216,8 @@ void process_cpuid()
41684216

41694217
if (!quiet)
41704218
dump_sysfs_cstate_config();
4219+
if (!quiet)
4220+
dump_sysfs_pstate_config();
41714221

41724222
if (has_skl_msrs(family, model))
41734223
calculate_tsc_tweak();

0 commit comments

Comments
 (0)