Skip to content

Commit db735f8

Browse files
committed
tools/power/turbostat: Relocate thermal probing code
Introduce probe_thermal(), and move all thermal probing related code into it. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Len Brown <len.brown@intel.com>
1 parent e7d7b82 commit db735f8

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4894,6 +4894,14 @@ void probe_rapl(void)
48944894
rapl_probe_amd();
48954895
}
48964896

4897+
void probe_thermal(void)
4898+
{
4899+
if (!access("/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count", R_OK))
4900+
BIC_PRESENT(BIC_CORE_THROT_CNT);
4901+
else
4902+
BIC_NOT_PRESENT(BIC_CORE_THROT_CNT);
4903+
}
4904+
48974905
int print_thermal(struct thread_data *t, struct core_data *c, struct pkg_data *p)
48984906
{
48994907
unsigned long long msr;
@@ -5598,14 +5606,11 @@ void process_cpuid()
55985606

55995607
probe_rapl();
56005608

5609+
probe_thermal();
5610+
56015611
if (platform->has_nhm_msrs)
56025612
BIC_PRESENT(BIC_SMI);
56035613

5604-
if (!access("/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count", R_OK))
5605-
BIC_PRESENT(BIC_CORE_THROT_CNT);
5606-
else
5607-
BIC_NOT_PRESENT(BIC_CORE_THROT_CNT);
5608-
56095614
if (!quiet)
56105615
decode_misc_feature_control();
56115616

0 commit comments

Comments
 (0)