]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
tools/power turbostat: detect and work around syscall jitter
authorLen Brown <len.brown@intel.com>
Sat, 27 Feb 2016 08:11:29 +0000 (03:11 -0500)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 29 Aug 2016 16:25:02 +0000 (10:25 -0600)
commitf5d20ff948e6a876242efa7a2767d1de3672c1e0
tree41a21c407bfaee3adaab4d2044d6b8f471d7b805
parentb8986387d9d1da98755373ad14eb268df4aa8c59
tools/power turbostat: detect and work around syscall jitter

BugLink: http://bugs.launchpad.net/bugs/1591802
The accuracy of Bzy_Mhz and Busy% depend on reading
the TSC, APERF, and MPERF close together in time.

When there is a very short measurement interval,
or a large system is profoundly idle, the changes
in APERF and MPERF may be very small.
They can be small enough that an expensive interrupt
between reading APERF and MPERF can cause the APERF/MPERF
ratio to become inaccurate, resulting in invalid
calculation and display of Bzy_MHz.

A dummy APERF read of APERF makes this problem
much more rare.  Apparently this 1st systemn call
after exiting a long stretch of idle is when we
typically see expensive timer interrupts that cause
large jitter.

For the cases that dummy APERF read fails to prevent,
we compare the latency of the APERF and MPERF reads.
If they differ by more than 2x, we re-issue them.

Signed-off-by: Len Brown <len.brown@intel.com>
(cherry picked from commit 0102b06747c7d24e334d2b27c4b43eed693676f1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
tools/power/x86/turbostat/turbostat.c