summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2017-03-04 15:42:48 -0500
committerLen Brown <len.brown@intel.com>2017-03-04 15:42:48 -0500
commit22048c5485503749754b3b5daf9d99ef89fcacdc (patch)
tree0c2eecaadd36b4ef8a3f18a5e75a1bd8cdd3085d /tools/power
parente3942ed8c66bcff496abee5182422cd542962d9e (diff)
downloadlinux-22048c5485503749754b3b5daf9d99ef89fcacdc.tar.gz
linux-22048c5485503749754b3b5daf9d99ef89fcacdc.tar.bz2
linux-22048c5485503749754b3b5daf9d99ef89fcacdc.zip
tools/power turbostat: bugfix: GFXMHz column not changing
turbostat displays a GFXMHz column, which comes from reading /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz But GFXMHz was not changing, even when a manual cat /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz showed a new value. It turns out that a rewind() on the open file is not sufficient, fflush() (or a close/open) is needed to read fresh values. Reported-by: Yaroslav Isakov <yaroslav.isakov@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 828dccd3f01e..d7fb6bcb2744 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2485,8 +2485,10 @@ int snapshot_gfx_mhz(void)
if (fp == NULL)
fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", "r");
- else
+ else {
rewind(fp);
+ fflush(fp);
+ }
retval = fscanf(fp, "%d", &gfx_cur_mhz);
if (retval != 1)