Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1622633
| From | Len Brown <lenb@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/7] tools/power turbostat: bugfix: GFXMHz column not changing |
| Date | 2017-04-13 02:20 +0200 |
| Message-ID | <tvAEq-3qZ-25@gated-at.bofh.it> (permalink) |
| References | <tvAuJ-3mx-3@gated-at.bofh.it> |
| Organization | Intel Open Source Technology Center |
From: Len Brown <len.brown@intel.com>
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>
---
tools/power/x86/turbostat/turbostat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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)
--
2.11.0.161.g6610af872
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL PATCH 0/7] turbostat fixes Len Brown <lenb@kernel.org> - 2017-04-13 02:10 +0200 [PATCH 6/7] tools/power turbostat: fix impossibly large CPU%c1 value Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 4/7] tools/power turbostat: update HWP dump to decimal from hex Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 7/7] tools/power turbostat: update version number Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 5/7] tools/power turbostat: turbostat.8 add missing column definitions Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 1/7] tools/power turbostat: bugfix: GFXMHz column not changing Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 Re: [GIT PULL PATCH 0/7] turbostat fixes "Rafael J. Wysocki" <rafael@kernel.org> - 2017-04-13 03:30 +0200
csiph-web