aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorAndrey Semin <andrey.semin@intel.com>2014-12-05 00:07:00 -0500
committerLen Brown <len.brown@intel.com>2015-04-18 14:20:52 -0400
commit40ee8e3b9dc8917e6077dde6a49c7a71d63b0231 (patch)
tree2797cc36f7470ce78938d0b945d1ee01c1217d35 /tools/power
parent0b2bb6925eb602eae993a4b5c282a8c18ad1c949 (diff)
tools/power turbostat: correct DRAM RAPL units on recent Xeon processors
While not yet documented in the Software Developer's Manual, the data-sheet for modern Xeon states that DRAM RAPL ENERGY units are fixed at 15.3 uJ, rather than being discovered via MSR. Before this patch, DRAM energy on these products is over-stated by turbostat because the RAPL units are 4x larger. ref: "Xeon E5-2600 v3/E5-1600 v3 Datasheet Volume 2" http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/xeon-e5-v3-datasheet-vol-2.pdf Signed-off-by: Andrey Semin <andrey.semin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index ad5688914446..064749de75b1 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -83,7 +83,8 @@ unsigned int do_dts;
83unsigned int do_ptm; 83unsigned int do_ptm;
84unsigned int tcc_activation_temp; 84unsigned int tcc_activation_temp;
85unsigned int tcc_activation_temp_override; 85unsigned int tcc_activation_temp_override;
86double rapl_power_units, rapl_energy_units, rapl_time_units; 86double rapl_power_units, rapl_time_units;
87double rapl_dram_energy_units, rapl_energy_units;
87double rapl_joule_counter_range; 88double rapl_joule_counter_range;
88unsigned int do_core_perf_limit_reasons; 89unsigned int do_core_perf_limit_reasons;
89unsigned int do_gfx_perf_limit_reasons; 90unsigned int do_gfx_perf_limit_reasons;
@@ -600,7 +601,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
600 if (do_rapl & RAPL_GFX) 601 if (do_rapl & RAPL_GFX)
601 outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units / interval_float); 602 outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units / interval_float);
602 if (do_rapl & RAPL_DRAM) 603 if (do_rapl & RAPL_DRAM)
603 outp += sprintf(outp, fmt8, p->energy_dram * rapl_energy_units / interval_float); 604 outp += sprintf(outp, fmt8, p->energy_dram * rapl_dram_energy_units / interval_float);
604 if (do_rapl & RAPL_PKG_PERF_STATUS) 605 if (do_rapl & RAPL_PKG_PERF_STATUS)
605 outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 606 outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
606 if (do_rapl & RAPL_DRAM_PERF_STATUS) 607 if (do_rapl & RAPL_DRAM_PERF_STATUS)
@@ -617,7 +618,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
617 p->energy_gfx * rapl_energy_units); 618 p->energy_gfx * rapl_energy_units);
618 if (do_rapl & RAPL_DRAM) 619 if (do_rapl & RAPL_DRAM)
619 outp += sprintf(outp, fmt8, 620 outp += sprintf(outp, fmt8,
620 p->energy_dram * rapl_energy_units); 621 p->energy_dram * rapl_dram_energy_units);
621 if (do_rapl & RAPL_PKG_PERF_STATUS) 622 if (do_rapl & RAPL_PKG_PERF_STATUS)
622 outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 623 outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
623 if (do_rapl & RAPL_DRAM_PERF_STATUS) 624 if (do_rapl & RAPL_DRAM_PERF_STATUS)
@@ -1935,6 +1936,25 @@ double get_tdp(model)
1935 } 1936 }
1936} 1937}
1937 1938
1939/*
1940 * rapl_dram_energy_units_probe()
1941 * Energy units are either hard-coded, or come from RAPL Energy Unit MSR.
1942 */
1943static double
1944rapl_dram_energy_units_probe(int model, double rapl_energy_units)
1945{
1946 /* only called for genuine_intel, family 6 */
1947
1948 switch (model) {
1949 case 0x3F: /* HSX */
1950 case 0x4F: /* BDX */
1951 case 0x56: /* BDX-DE */
1952 return (rapl_dram_energy_units = 15.3 / 1000000);
1953 default:
1954 return (rapl_energy_units);
1955 }
1956}
1957
1938 1958
1939/* 1959/*
1940 * rapl_probe() 1960 * rapl_probe()
@@ -1994,6 +2014,8 @@ void rapl_probe(unsigned int family, unsigned int model)
1994 else 2014 else
1995 rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F)); 2015 rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F));
1996 2016
2017 rapl_dram_energy_units = rapl_dram_energy_units_probe(model, rapl_energy_units);
2018
1997 time_unit = msr >> 16 & 0xF; 2019 time_unit = msr >> 16 & 0xF;
1998 if (time_unit == 0) 2020 if (time_unit == 0)
1999 time_unit = 0xA; 2021 time_unit = 0xA;