Skip to content

Commit e7d7b82

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

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5374,6 +5374,26 @@ void probe_cstates(void)
53745374
dump_sysfs_cstate_config();
53755375
}
53765376

5377+
void probe_lpi(void)
5378+
{
5379+
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
5380+
BIC_PRESENT(BIC_CPU_LPI);
5381+
else
5382+
BIC_NOT_PRESENT(BIC_CPU_LPI);
5383+
5384+
if (!access(sys_lpi_file_sysfs, R_OK)) {
5385+
sys_lpi_file = sys_lpi_file_sysfs;
5386+
BIC_PRESENT(BIC_SYS_LPI);
5387+
} else if (!access(sys_lpi_file_debugfs, R_OK)) {
5388+
sys_lpi_file = sys_lpi_file_debugfs;
5389+
BIC_PRESENT(BIC_SYS_LPI);
5390+
} else {
5391+
sys_lpi_file_sysfs = NULL;
5392+
BIC_NOT_PRESENT(BIC_SYS_LPI);
5393+
}
5394+
5395+
}
5396+
53775397
void probe_pstates(void)
53785398
{
53795399
probe_bclk();
@@ -5570,6 +5590,8 @@ void process_cpuid()
55705590

55715591
probe_cstates();
55725592

5593+
probe_lpi();
5594+
55735595
probe_intel_uncore_frequency();
55745596

55755597
probe_graphics();
@@ -5579,27 +5601,11 @@ void process_cpuid()
55795601
if (platform->has_nhm_msrs)
55805602
BIC_PRESENT(BIC_SMI);
55815603

5582-
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
5583-
BIC_PRESENT(BIC_CPU_LPI);
5584-
else
5585-
BIC_NOT_PRESENT(BIC_CPU_LPI);
5586-
55875604
if (!access("/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count", R_OK))
55885605
BIC_PRESENT(BIC_CORE_THROT_CNT);
55895606
else
55905607
BIC_NOT_PRESENT(BIC_CORE_THROT_CNT);
55915608

5592-
if (!access(sys_lpi_file_sysfs, R_OK)) {
5593-
sys_lpi_file = sys_lpi_file_sysfs;
5594-
BIC_PRESENT(BIC_SYS_LPI);
5595-
} else if (!access(sys_lpi_file_debugfs, R_OK)) {
5596-
sys_lpi_file = sys_lpi_file_debugfs;
5597-
BIC_PRESENT(BIC_SYS_LPI);
5598-
} else {
5599-
sys_lpi_file_sysfs = NULL;
5600-
BIC_NOT_PRESENT(BIC_SYS_LPI);
5601-
}
5602-
56035609
if (!quiet)
56045610
decode_misc_feature_control();
56055611

0 commit comments

Comments
 (0)