]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools/power turbostat: work around RC6 counter wrap
authorLen Brown <len.brown@intel.com>
Wed, 6 Apr 2016 21:16:00 +0000 (17:16 -0400)
committerDhaval Giani <dhaval.giani@oracle.com>
Mon, 16 Jan 2017 20:11:18 +0000 (15:11 -0500)
commita4476ff01c63562033397408271eb0eef8718d68
tree42be6ee2065b8a8194527258fc86300f0b854d29
parentacd3f4ee852b480f9d1d7cbace2c4eec993cb807
tools/power turbostat: work around RC6 counter wrap

Orabug: 24811361

Sometimes the rc6 sysfs counter spontaneously resets,
causing turbostat prints a very large number
as it tries to calcuate % = 100 * (old - new) / interval

When we see (old > new), print ***.**% instead
of a bogus huge number.

Note that this detection is not fool-proof, as the counter
could reset several times and still result in new > old.

Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 9185e988e9d5bb70b690362e84bb2e4a9d71f2c5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
tools/power/x86/turbostat/turbostat.c