diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.8 | 36 | ||||
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 26 |
2 files changed, 38 insertions, 24 deletions
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8 index 0d7dc2cfefb5..b4ddb748356c 100644 --- a/tools/power/x86/turbostat/turbostat.8 +++ b/tools/power/x86/turbostat/turbostat.8 | |||
@@ -31,8 +31,6 @@ The \fB-S\fP option limits output to a 1-line System Summary for each interval. | |||
31 | .PP | 31 | .PP |
32 | The \fB-v\fP option increases verbosity. | 32 | The \fB-v\fP option increases verbosity. |
33 | .PP | 33 | .PP |
34 | The \fB-s\fP option prints the SMI counter, equivalent to "-c 0x34" | ||
35 | .PP | ||
36 | The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter. | 34 | The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter. |
37 | .PP | 35 | .PP |
38 | The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter. | 36 | The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter. |
@@ -186,26 +184,24 @@ This is a weighted average, where the weight is %c0. ie. it is the total number | |||
186 | un-halted cycles elapsed per time divided by the number of CPUs. | 184 | un-halted cycles elapsed per time divided by the number of CPUs. |
187 | .SH SMI COUNTING EXAMPLE | 185 | .SH SMI COUNTING EXAMPLE |
188 | On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter. | 186 | On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter. |
189 | Using the -m option, you can display how many SMIs have fired since reset, or if there | 187 | This counter is shown by default under the "SMI" column. |
190 | are SMIs during the measurement interval, you can display the delta using the -d option. | ||
191 | .nf | 188 | .nf |
192 | [root@x980 ~]# turbostat -m 0x34 | 189 | [root@x980 ~]# turbostat |
193 | cor CPU %c0 GHz TSC MSR 0x034 %c1 %c3 %c6 %pc3 %pc6 | 190 | cor CPU %c0 GHz TSC SMI %c1 %c3 %c6 CTMP %pc3 %pc6 |
194 | 1.41 1.82 3.38 0x00000000 8.92 37.82 51.85 17.37 0.55 | 191 | 0.11 1.91 3.38 0 1.84 0.26 97.79 29 0.82 83.87 |
195 | 0 0 3.73 2.03 3.38 0x00000055 1.72 48.25 46.31 17.38 0.55 | 192 | 0 0 0.40 1.63 3.38 0 10.27 0.12 89.20 20 0.82 83.88 |
196 | 0 6 0.14 1.63 3.38 0x00000056 5.30 | 193 | 0 6 0.06 1.63 3.38 0 10.61 |
197 | 1 2 2.51 1.80 3.38 0x00000056 15.65 29.33 52.52 | 194 | 1 2 0.37 2.63 3.38 0 0.02 0.10 99.51 22 |
198 | 1 8 0.10 1.65 3.38 0x00000056 18.05 | 195 | 1 8 0.01 1.62 3.38 0 0.39 |
199 | 2 4 1.16 1.68 3.38 0x00000056 5.87 24.47 68.50 | 196 | 2 4 0.07 1.62 3.38 0 0.04 0.07 99.82 23 |
200 | 2 10 0.10 1.63 3.38 0x00000056 6.93 | 197 | 2 10 0.02 1.62 3.38 0 0.09 |
201 | 8 1 3.84 1.91 3.38 0x00000056 1.36 50.65 44.16 | 198 | 8 1 0.23 1.64 3.38 0 0.10 1.07 98.60 24 |
202 | 8 7 0.08 1.64 3.38 0x00000056 5.12 | 199 | 8 7 0.02 1.64 3.38 0 0.31 |
203 | 9 3 1.82 1.73 3.38 0x00000056 7.59 24.21 66.38 | 200 | 9 3 0.03 1.62 3.38 0 0.03 0.05 99.89 29 |
204 | 9 9 0.09 1.68 3.38 0x00000056 9.32 | 201 | 9 9 0.02 1.62 3.38 0 0.05 |
205 | 10 5 1.66 1.65 3.38 0x00000056 15.10 50.00 33.23 | 202 | 10 5 0.07 1.62 3.38 0 0.08 0.12 99.73 27 |
206 | 10 11 1.72 1.65 3.38 0x00000056 15.05 | 203 | 10 11 0.03 1.62 3.38 0 0.13 |
207 | ^C | 204 | ^C |
208 | [root@x980 ~]# | ||
209 | .fi | 205 | .fi |
210 | .SH NOTES | 206 | .SH NOTES |
211 | 207 | ||
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 75f64e05ec30..6f3214ed4444 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -58,6 +58,7 @@ unsigned int extra_msr_offset32; | |||
58 | unsigned int extra_msr_offset64; | 58 | unsigned int extra_msr_offset64; |
59 | unsigned int extra_delta_offset32; | 59 | unsigned int extra_delta_offset32; |
60 | unsigned int extra_delta_offset64; | 60 | unsigned int extra_delta_offset64; |
61 | int do_smi; | ||
61 | double bclk; | 62 | double bclk; |
62 | unsigned int show_pkg; | 63 | unsigned int show_pkg; |
63 | unsigned int show_core; | 64 | unsigned int show_core; |
@@ -99,6 +100,7 @@ struct thread_data { | |||
99 | unsigned long long extra_delta64; | 100 | unsigned long long extra_delta64; |
100 | unsigned long long extra_msr32; | 101 | unsigned long long extra_msr32; |
101 | unsigned long long extra_delta32; | 102 | unsigned long long extra_delta32; |
103 | unsigned int smi_count; | ||
102 | unsigned int cpu_id; | 104 | unsigned int cpu_id; |
103 | unsigned int flags; | 105 | unsigned int flags; |
104 | #define CPU_IS_FIRST_THREAD_IN_CORE 0x2 | 106 | #define CPU_IS_FIRST_THREAD_IN_CORE 0x2 |
@@ -248,6 +250,8 @@ void print_header(void) | |||
248 | if (has_aperf) | 250 | if (has_aperf) |
249 | outp += sprintf(outp, " GHz"); | 251 | outp += sprintf(outp, " GHz"); |
250 | outp += sprintf(outp, " TSC"); | 252 | outp += sprintf(outp, " TSC"); |
253 | if (do_smi) | ||
254 | outp += sprintf(outp, " SMI"); | ||
251 | if (extra_delta_offset32) | 255 | if (extra_delta_offset32) |
252 | outp += sprintf(outp, " count 0x%03X", extra_delta_offset32); | 256 | outp += sprintf(outp, " count 0x%03X", extra_delta_offset32); |
253 | if (extra_delta_offset64) | 257 | if (extra_delta_offset64) |
@@ -314,6 +318,8 @@ int dump_counters(struct thread_data *t, struct core_data *c, | |||
314 | extra_msr_offset32, t->extra_msr32); | 318 | extra_msr_offset32, t->extra_msr32); |
315 | fprintf(stderr, "msr0x%x: %016llX\n", | 319 | fprintf(stderr, "msr0x%x: %016llX\n", |
316 | extra_msr_offset64, t->extra_msr64); | 320 | extra_msr_offset64, t->extra_msr64); |
321 | if (do_smi) | ||
322 | fprintf(stderr, "SMI: %08X\n", t->smi_count); | ||
317 | } | 323 | } |
318 | 324 | ||
319 | if (c) { | 325 | if (c) { |
@@ -352,6 +358,7 @@ int dump_counters(struct thread_data *t, struct core_data *c, | |||
352 | * RAM_W: %5.2 | 358 | * RAM_W: %5.2 |
353 | * GHz: "GHz" 3 columns %3.2 | 359 | * GHz: "GHz" 3 columns %3.2 |
354 | * TSC: "TSC" 3 columns %3.2 | 360 | * TSC: "TSC" 3 columns %3.2 |
361 | * SMI: "SMI" 4 columns %4d | ||
355 | * percentage " %pc3" %6.2 | 362 | * percentage " %pc3" %6.2 |
356 | * Perf Status percentage: %5.2 | 363 | * Perf Status percentage: %5.2 |
357 | * "CTMP" 4 columns %4d | 364 | * "CTMP" 4 columns %4d |
@@ -431,6 +438,10 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
431 | /* TSC */ | 438 | /* TSC */ |
432 | outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float); | 439 | outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float); |
433 | 440 | ||
441 | /* SMI */ | ||
442 | if (do_smi) | ||
443 | outp += sprintf(outp, "%4d", t->smi_count); | ||
444 | |||
434 | /* delta */ | 445 | /* delta */ |
435 | if (extra_delta_offset32) | 446 | if (extra_delta_offset32) |
436 | outp += sprintf(outp, " %11llu", t->extra_delta32); | 447 | outp += sprintf(outp, " %11llu", t->extra_delta32); |
@@ -645,6 +656,9 @@ delta_thread(struct thread_data *new, struct thread_data *old, | |||
645 | */ | 656 | */ |
646 | old->extra_msr32 = new->extra_msr32; | 657 | old->extra_msr32 = new->extra_msr32; |
647 | old->extra_msr64 = new->extra_msr64; | 658 | old->extra_msr64 = new->extra_msr64; |
659 | |||
660 | if (do_smi) | ||
661 | old->smi_count = new->smi_count - old->smi_count; | ||
648 | } | 662 | } |
649 | 663 | ||
650 | int delta_cpu(struct thread_data *t, struct core_data *c, | 664 | int delta_cpu(struct thread_data *t, struct core_data *c, |
@@ -672,6 +686,7 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data | |||
672 | t->mperf = 0; | 686 | t->mperf = 0; |
673 | t->c1 = 0; | 687 | t->c1 = 0; |
674 | 688 | ||
689 | t->smi_count = 0; | ||
675 | t->extra_delta32 = 0; | 690 | t->extra_delta32 = 0; |
676 | t->extra_delta64 = 0; | 691 | t->extra_delta64 = 0; |
677 | 692 | ||
@@ -802,6 +817,11 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
802 | return -4; | 817 | return -4; |
803 | } | 818 | } |
804 | 819 | ||
820 | if (do_smi) { | ||
821 | if (get_msr(cpu, MSR_SMI_COUNT, &msr)) | ||
822 | return -5; | ||
823 | t->smi_count = msr & 0xFFFFFFFF; | ||
824 | } | ||
805 | if (extra_delta_offset32) { | 825 | if (extra_delta_offset32) { |
806 | if (get_msr(cpu, extra_delta_offset32, &msr)) | 826 | if (get_msr(cpu, extra_delta_offset32, &msr)) |
807 | return -5; | 827 | return -5; |
@@ -1893,6 +1913,7 @@ void check_cpuid() | |||
1893 | 1913 | ||
1894 | do_nehalem_platform_info = genuine_intel && has_invariant_tsc; | 1914 | do_nehalem_platform_info = genuine_intel && has_invariant_tsc; |
1895 | do_nhm_cstates = genuine_intel; /* all Intel w/ non-stop TSC have NHM counters */ | 1915 | do_nhm_cstates = genuine_intel; /* all Intel w/ non-stop TSC have NHM counters */ |
1916 | do_smi = do_nhm_cstates; | ||
1896 | do_snb_cstates = is_snb(family, model); | 1917 | do_snb_cstates = is_snb(family, model); |
1897 | bclk = discover_bclk(family, model); | 1918 | bclk = discover_bclk(family, model); |
1898 | 1919 | ||
@@ -2229,9 +2250,6 @@ void cmdline(int argc, char **argv) | |||
2229 | case 'c': | 2250 | case 'c': |
2230 | sscanf(optarg, "%x", &extra_delta_offset32); | 2251 | sscanf(optarg, "%x", &extra_delta_offset32); |
2231 | break; | 2252 | break; |
2232 | case 's': | ||
2233 | extra_delta_offset32 = 0x34; /* SMI counter */ | ||
2234 | break; | ||
2235 | case 'C': | 2253 | case 'C': |
2236 | sscanf(optarg, "%x", &extra_delta_offset64); | 2254 | sscanf(optarg, "%x", &extra_delta_offset64); |
2237 | break; | 2255 | break; |
@@ -2258,7 +2276,7 @@ int main(int argc, char **argv) | |||
2258 | cmdline(argc, argv); | 2276 | cmdline(argc, argv); |
2259 | 2277 | ||
2260 | if (verbose) | 2278 | if (verbose) |
2261 | fprintf(stderr, "turbostat v3.1 January 8, 2013" | 2279 | fprintf(stderr, "turbostat v3.2 February 11, 2013" |
2262 | " - Len Brown <lenb@kernel.org>\n"); | 2280 | " - Len Brown <lenb@kernel.org>\n"); |
2263 | 2281 | ||
2264 | turbostat_init(); | 2282 | turbostat_init(); |