Skip to content

Commit 5612b2c

Browse files
committed
tools/power/turbostat: Relocate more probing related code
Relocate more feature probing code outside of process_cpuids() into the corresponding probing functions. This improves the readability of code and the turbostat output. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
1 parent ce7a32c commit 5612b2c

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,6 +5023,11 @@ void probe_rapl(void)
50235023
rapl_probe_intel();
50245024
if (authentic_amd || hygon_genuine)
50255025
rapl_probe_amd();
5026+
5027+
if (quiet)
5028+
return;
5029+
5030+
for_all_cpus(print_rapl, ODD_COUNTERS);
50265031
}
50275032

50285033
/*
@@ -5173,6 +5178,13 @@ void probe_thermal(void)
51735178
BIC_PRESENT(BIC_CORE_THROT_CNT);
51745179
else
51755180
BIC_NOT_PRESENT(BIC_CORE_THROT_CNT);
5181+
5182+
for_all_cpus(set_temperature_target, ODD_COUNTERS);
5183+
5184+
if (quiet)
5185+
return;
5186+
5187+
for_all_cpus(print_thermal, ODD_COUNTERS);
51765188
}
51775189

51785190
int get_cpu_type(struct thread_data *t, struct core_data *c, struct pkg_data *p)
@@ -5380,6 +5392,7 @@ void probe_cstates(void)
53805392
decode_c6_demotion_policy_msr();
53815393
print_dev_latency();
53825394
dump_sysfs_cstate_config();
5395+
print_irtl();
53835396
}
53845397

53855398
void probe_lpi(void)
@@ -5413,6 +5426,10 @@ void probe_pstates(void)
54135426
dump_turbo_ratio_info();
54145427
dump_sysfs_pstate_config();
54155428
decode_misc_pwr_mgmt_msr();
5429+
5430+
for_all_cpus(print_hwp, ODD_COUNTERS);
5431+
for_all_cpus(print_epb, ODD_COUNTERS);
5432+
for_all_cpus(print_perf_limit, ODD_COUNTERS);
54165433
}
54175434

54185435
void process_cpuid()
@@ -5897,29 +5914,9 @@ void turbostat_init()
58975914
process_cpuid();
58985915
linux_perf_init();
58995916

5900-
if (!quiet)
5901-
for_all_cpus(print_hwp, ODD_COUNTERS);
5902-
5903-
if (!quiet)
5904-
for_all_cpus(print_epb, ODD_COUNTERS);
5905-
5906-
if (!quiet)
5907-
for_all_cpus(print_perf_limit, ODD_COUNTERS);
5908-
5909-
if (!quiet)
5910-
for_all_cpus(print_rapl, ODD_COUNTERS);
5911-
5912-
for_all_cpus(set_temperature_target, ODD_COUNTERS);
5913-
59145917
for_all_cpus(get_cpu_type, ODD_COUNTERS);
59155918
for_all_cpus(get_cpu_type, EVEN_COUNTERS);
59165919

5917-
if (!quiet)
5918-
for_all_cpus(print_thermal, ODD_COUNTERS);
5919-
5920-
if (!quiet)
5921-
print_irtl();
5922-
59235920
if (DO_BIC(BIC_IPC))
59245921
(void)get_instr_count_fd(base_cpu);
59255922
}

0 commit comments

Comments
 (0)