summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorPatryk Wlazlyn <patryk.wlazlyn@linux.intel.com>2024-01-22 15:22:35 +0100
committerLen Brown <len.brown@intel.com>2024-04-02 12:50:02 -0400
commit538d505fde20393bce1e6fb95cec82b56cdd22ef (patch)
treed71cc50d3a0aeb1bc59964bc153fc1f1ae238788 /tools/power
parentfb5ceca046efc84f69fcf9779a013f8a0e63bbff (diff)
tools/power turbostat: Read base_hz and bclk from CPUID.16H if available
If MSRs cannot be read, values can be obtained from cpuid. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index a4a40a6e1b95..c35c48b6a99a 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5848,6 +5848,15 @@ void process_cpuid()
base_mhz = max_mhz = bus_mhz = edx = 0;
__cpuid(0x16, base_mhz, max_mhz, bus_mhz, edx);
+
+ bclk = bus_mhz;
+
+ base_hz = base_mhz * 1000000;
+ has_base_hz = 1;
+
+ if (platform->enable_tsc_tweak)
+ tsc_tweak = base_hz / tsc_hz;
+
if (!quiet)
fprintf(outf, "CPUID(0x16): base_mhz: %d max_mhz: %d bus_mhz: %d\n",
base_mhz, max_mhz, bus_mhz);