summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/utils/cpufreq-info.c
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2011-07-21 11:54:53 +0200
committerDominik Brodowski <linux@dominikbrodowski.net>2011-07-29 19:37:25 +0200
commit8fb2e440b223b966f74a04a48f6f71f288fa671b (patch)
tree3a9f2c19c039072d0b2641385bf0e6897bed2361 /tools/power/cpupower/utils/cpufreq-info.c
parent76b659a31df5174d71832b7882ef31b32e1f8d59 (diff)
cpupower: Show Intel turbo ratio support via ./cpupower frequency-info
This adds the last piece missing from turbostat (if called with -v). It shows on Intel machines supporting Turbo Boost how many cores have to be active/idle to enter which boost mode (frequency). Whether the HW really enters these boost modes can be verified via ./cpupower monitor. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: lenb@kernel.org CC: linux@dominikbrodowski.net CC: cpufreq@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'tools/power/cpupower/utils/cpufreq-info.c')
-rw-r--r--tools/power/cpupower/utils/cpufreq-info.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 8628644188cf..5a1d25f056b3 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -165,26 +165,56 @@ static int get_boost_mode(unsigned int cpu)
printf(_(" Supported: %s\n"), support ? _("yes") : _("no"));
printf(_(" Active: %s\n"), active ? _("yes") : _("no"));
- /* ToDo: Only works for AMD for now... */
-
if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
cpupower_cpu_info.family >= 0x10) {
ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states,
pstates, &pstate_no);
if (ret)
return ret;
- } else
- return 0;
- printf(_(" Boost States: %d\n"), b_states);
- printf(_(" Total States: %d\n"), pstate_no);
- for (i = 0; i < pstate_no; i++) {
- if (i < b_states)
- printf(_(" Pstate-Pb%d: %luMHz (boost state)\n"),
- i, pstates[i]);
+ printf(_(" Boost States: %d\n"), b_states);
+ printf(_(" Total States: %d\n"), pstate_no);
+ for (i = 0; i < pstate_no; i++) {
+ if (i < b_states)
+ printf(_(" Pstate-Pb%d: %luMHz (boost state)"
+ "\n"), i, pstates[i]);
+ else
+ printf(_(" Pstate-P%d: %luMHz\n"),
+ i - b_states, pstates[i]);
+ }
+ } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_HAS_TURBO_RATIO) {
+ double bclk;
+ unsigned long long intel_turbo_ratio = 0;
+ unsigned int ratio;
+
+ /* Any way to autodetect this ? */
+ if (cpupower_cpu_info.caps & CPUPOWER_CAP_IS_SNB)
+ bclk = 100.00;
else
- printf(_(" Pstate-P%d: %luMHz\n"),
- i - b_states, pstates[i]);
+ bclk = 133.33;
+ intel_turbo_ratio = msr_intel_get_turbo_ratio(cpu);
+ dprint (" Ratio: 0x%llx - bclk: %f\n",
+ intel_turbo_ratio, bclk);
+
+ ratio = (intel_turbo_ratio >> 24) & 0xFF;
+ if (ratio)
+ printf(_(" %.0f MHz max turbo 4 active cores\n"),
+ ratio * bclk);
+
+ ratio = (intel_turbo_ratio >> 16) & 0xFF;
+ if (ratio)
+ printf(_(" %.0f MHz max turbo 3 active cores\n"),
+ ratio * bclk);
+
+ ratio = (intel_turbo_ratio >> 8) & 0xFF;
+ if (ratio)
+ printf(_(" %.0f MHz max turbo 2 active cores\n"),
+ ratio * bclk);
+
+ ratio = (intel_turbo_ratio >> 0) & 0xFF;
+ if (ratio)
+ printf(_(" %.0f MHz max turbo 1 active cores\n"),
+ ratio * bclk);
}
return 0;
}