Skip to content

Commit 2538d16

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

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4424,6 +4424,20 @@ static void probe_intel_uncore_frequency(void)
44244424
}
44254425
}
44264426

4427+
static void probe_graphics(void)
4428+
{
4429+
if (!access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK))
4430+
BIC_PRESENT(BIC_GFX_rc6);
4431+
4432+
if (!access("/sys/class/drm/card0/gt_cur_freq_mhz", R_OK) ||
4433+
!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
4434+
BIC_PRESENT(BIC_GFXMHz);
4435+
4436+
if (!access("/sys/class/drm/card0/gt_act_freq_mhz", R_OK) ||
4437+
!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
4438+
BIC_PRESENT(BIC_GFXACTMHz);
4439+
}
4440+
44274441
static void dump_sysfs_cstate_config(void)
44284442
{
44294443
char path[64];
@@ -5558,22 +5572,13 @@ void process_cpuid()
55585572

55595573
probe_intel_uncore_frequency();
55605574

5575+
probe_graphics();
5576+
55615577
probe_rapl();
55625578

55635579
if (platform->has_nhm_msrs)
55645580
BIC_PRESENT(BIC_SMI);
55655581

5566-
if (!access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK))
5567-
BIC_PRESENT(BIC_GFX_rc6);
5568-
5569-
if (!access("/sys/class/drm/card0/gt_cur_freq_mhz", R_OK) ||
5570-
!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
5571-
BIC_PRESENT(BIC_GFXMHz);
5572-
5573-
if (!access("/sys/class/drm/card0/gt_act_freq_mhz", R_OK) ||
5574-
!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
5575-
BIC_PRESENT(BIC_GFXACTMHz);
5576-
55775582
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
55785583
BIC_PRESENT(BIC_CPU_LPI);
55795584
else

0 commit comments

Comments
 (0)