diff options
author | Len Brown <len.brown@intel.com> | 2017-05-20 20:11:55 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2017-06-23 23:52:23 -0400 |
commit | a99d87306f83d2a97c8c7e854b6583c4037ecf75 (patch) | |
tree | db966e4d8dd7f5db5211151a0e9e91b3d7108d47 /tools | |
parent | 3c2993b8c6143d8a5793746a54eba8f86f95240f (diff) |
tools/power turbostat: hide SKL counters, when not requested
Skylake has some new counters, and they were erroneously
exempt from --show and --hide
eg.
turbostat --quiet --show CPU
CPU Totl%C0 Any%C0 GFX%C0 CPUGFX%
- 116.73 90.56 85.69 79.00
0 117.78 91.38 86.47 79.71
2
1
3
is now
CPU
-
0
2
1
3
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index b11294730771..2b25727bd3d7 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -57,7 +57,6 @@ unsigned int list_header_only; | |||
57 | unsigned int dump_only; | 57 | unsigned int dump_only; |
58 | unsigned int do_snb_cstates; | 58 | unsigned int do_snb_cstates; |
59 | unsigned int do_knl_cstates; | 59 | unsigned int do_knl_cstates; |
60 | unsigned int do_skl_residency; | ||
61 | unsigned int do_slm_cstates; | 60 | unsigned int do_slm_cstates; |
62 | unsigned int use_c1_residency_msr; | 61 | unsigned int use_c1_residency_msr; |
63 | unsigned int has_aperf; | 62 | unsigned int has_aperf; |
@@ -384,8 +383,14 @@ struct msr_counter bic[] = { | |||
384 | { 0x0, "CPU" }, | 383 | { 0x0, "CPU" }, |
385 | { 0x0, "Mod%c6" }, | 384 | { 0x0, "Mod%c6" }, |
386 | { 0x0, "sysfs" }, | 385 | { 0x0, "sysfs" }, |
386 | { 0x0, "Totl%C0" }, | ||
387 | { 0x0, "Any%C0" }, | ||
388 | { 0x0, "GFX%C0" }, | ||
389 | { 0x0, "CPUGFX%" }, | ||
387 | }; | 390 | }; |
388 | 391 | ||
392 | |||
393 | |||
389 | #define MAX_BIC (sizeof(bic) / sizeof(struct msr_counter)) | 394 | #define MAX_BIC (sizeof(bic) / sizeof(struct msr_counter)) |
390 | #define BIC_Package (1ULL << 0) | 395 | #define BIC_Package (1ULL << 0) |
391 | #define BIC_Avg_MHz (1ULL << 1) | 396 | #define BIC_Avg_MHz (1ULL << 1) |
@@ -426,6 +431,10 @@ struct msr_counter bic[] = { | |||
426 | #define BIC_CPU (1ULL << 36) | 431 | #define BIC_CPU (1ULL << 36) |
427 | #define BIC_Mod_c6 (1ULL << 37) | 432 | #define BIC_Mod_c6 (1ULL << 37) |
428 | #define BIC_sysfs (1ULL << 38) | 433 | #define BIC_sysfs (1ULL << 38) |
434 | #define BIC_Totl_c0 (1ULL << 39) | ||
435 | #define BIC_Any_c0 (1ULL << 40) | ||
436 | #define BIC_GFX_c0 (1ULL << 41) | ||
437 | #define BIC_CPUGFX (1ULL << 42) | ||
429 | 438 | ||
430 | unsigned long long bic_enabled = 0xFFFFFFFFFFFFFFFFULL; | 439 | unsigned long long bic_enabled = 0xFFFFFFFFFFFFFFFFULL; |
431 | unsigned long long bic_present = BIC_sysfs; | 440 | unsigned long long bic_present = BIC_sysfs; |
@@ -599,12 +608,14 @@ void print_header(char *delim) | |||
599 | if (DO_BIC(BIC_GFXMHz)) | 608 | if (DO_BIC(BIC_GFXMHz)) |
600 | outp += sprintf(outp, "%sGFXMHz", (printed++ ? delim : "")); | 609 | outp += sprintf(outp, "%sGFXMHz", (printed++ ? delim : "")); |
601 | 610 | ||
602 | if (do_skl_residency) { | 611 | if (DO_BIC(BIC_Totl_c0)) |
603 | outp += sprintf(outp, "%sTotl%%C0", (printed++ ? delim : "")); | 612 | outp += sprintf(outp, "%sTotl%%C0", (printed++ ? delim : "")); |
613 | if (DO_BIC(BIC_Any_c0)) | ||
604 | outp += sprintf(outp, "%sAny%%C0", (printed++ ? delim : "")); | 614 | outp += sprintf(outp, "%sAny%%C0", (printed++ ? delim : "")); |
615 | if (DO_BIC(BIC_GFX_c0)) | ||
605 | outp += sprintf(outp, "%sGFX%%C0", (printed++ ? delim : "")); | 616 | outp += sprintf(outp, "%sGFX%%C0", (printed++ ? delim : "")); |
617 | if (DO_BIC(BIC_CPUGFX)) | ||
606 | outp += sprintf(outp, "%sCPUGFX%%", (printed++ ? delim : "")); | 618 | outp += sprintf(outp, "%sCPUGFX%%", (printed++ ? delim : "")); |
607 | } | ||
608 | 619 | ||
609 | if (DO_BIC(BIC_Pkgpc2)) | 620 | if (DO_BIC(BIC_Pkgpc2)) |
610 | outp += sprintf(outp, "%sPkg%%pc2", (printed++ ? delim : "")); | 621 | outp += sprintf(outp, "%sPkg%%pc2", (printed++ ? delim : "")); |
@@ -912,12 +923,14 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
912 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->gfx_mhz); | 923 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->gfx_mhz); |
913 | 924 | ||
914 | /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */ | 925 | /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */ |
915 | if (do_skl_residency) { | 926 | if (DO_BIC(BIC_Totl_c0)) |
916 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_wtd_core_c0/tsc); | 927 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_wtd_core_c0/tsc); |
928 | if (DO_BIC(BIC_Any_c0)) | ||
917 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_any_core_c0/tsc); | 929 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_any_core_c0/tsc); |
930 | if (DO_BIC(BIC_GFX_c0)) | ||
918 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_any_gfxe_c0/tsc); | 931 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_any_gfxe_c0/tsc); |
932 | if (DO_BIC(BIC_CPUGFX)) | ||
919 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_both_core_gfxe_c0/tsc); | 933 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_both_core_gfxe_c0/tsc); |
920 | } | ||
921 | 934 | ||
922 | if (DO_BIC(BIC_Pkgpc2)) | 935 | if (DO_BIC(BIC_Pkgpc2)) |
923 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc2/tsc); | 936 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc2/tsc); |
@@ -1038,12 +1051,16 @@ delta_package(struct pkg_data *new, struct pkg_data *old) | |||
1038 | int i; | 1051 | int i; |
1039 | struct msr_counter *mp; | 1052 | struct msr_counter *mp; |
1040 | 1053 | ||
1041 | if (do_skl_residency) { | 1054 | |
1055 | if (DO_BIC(BIC_Totl_c0)) | ||
1042 | old->pkg_wtd_core_c0 = new->pkg_wtd_core_c0 - old->pkg_wtd_core_c0; | 1056 | old->pkg_wtd_core_c0 = new->pkg_wtd_core_c0 - old->pkg_wtd_core_c0; |
1057 | if (DO_BIC(BIC_Any_c0)) | ||
1043 | old->pkg_any_core_c0 = new->pkg_any_core_c0 - old->pkg_any_core_c0; | 1058 | old->pkg_any_core_c0 = new->pkg_any_core_c0 - old->pkg_any_core_c0; |
1059 | if (DO_BIC(BIC_GFX_c0)) | ||
1044 | old->pkg_any_gfxe_c0 = new->pkg_any_gfxe_c0 - old->pkg_any_gfxe_c0; | 1060 | old->pkg_any_gfxe_c0 = new->pkg_any_gfxe_c0 - old->pkg_any_gfxe_c0; |
1061 | if (DO_BIC(BIC_CPUGFX)) | ||
1045 | old->pkg_both_core_gfxe_c0 = new->pkg_both_core_gfxe_c0 - old->pkg_both_core_gfxe_c0; | 1062 | old->pkg_both_core_gfxe_c0 = new->pkg_both_core_gfxe_c0 - old->pkg_both_core_gfxe_c0; |
1046 | } | 1063 | |
1047 | old->pc2 = new->pc2 - old->pc2; | 1064 | old->pc2 = new->pc2 - old->pc2; |
1048 | if (DO_BIC(BIC_Pkgpc3)) | 1065 | if (DO_BIC(BIC_Pkgpc3)) |
1049 | old->pc3 = new->pc3 - old->pc3; | 1066 | old->pc3 = new->pc3 - old->pc3; |
@@ -1292,12 +1309,14 @@ int sum_counters(struct thread_data *t, struct core_data *c, | |||
1292 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) | 1309 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) |
1293 | return 0; | 1310 | return 0; |
1294 | 1311 | ||
1295 | if (do_skl_residency) { | 1312 | if (DO_BIC(BIC_Totl_c0)) |
1296 | average.packages.pkg_wtd_core_c0 += p->pkg_wtd_core_c0; | 1313 | average.packages.pkg_wtd_core_c0 += p->pkg_wtd_core_c0; |
1314 | if (DO_BIC(BIC_Any_c0)) | ||
1297 | average.packages.pkg_any_core_c0 += p->pkg_any_core_c0; | 1315 | average.packages.pkg_any_core_c0 += p->pkg_any_core_c0; |
1316 | if (DO_BIC(BIC_GFX_c0)) | ||
1298 | average.packages.pkg_any_gfxe_c0 += p->pkg_any_gfxe_c0; | 1317 | average.packages.pkg_any_gfxe_c0 += p->pkg_any_gfxe_c0; |
1318 | if (DO_BIC(BIC_CPUGFX)) | ||
1299 | average.packages.pkg_both_core_gfxe_c0 += p->pkg_both_core_gfxe_c0; | 1319 | average.packages.pkg_both_core_gfxe_c0 += p->pkg_both_core_gfxe_c0; |
1300 | } | ||
1301 | 1320 | ||
1302 | average.packages.pc2 += p->pc2; | 1321 | average.packages.pc2 += p->pc2; |
1303 | if (DO_BIC(BIC_Pkgpc3)) | 1322 | if (DO_BIC(BIC_Pkgpc3)) |
@@ -1357,12 +1376,14 @@ void compute_average(struct thread_data *t, struct core_data *c, | |||
1357 | average.cores.c7 /= topo.num_cores; | 1376 | average.cores.c7 /= topo.num_cores; |
1358 | average.cores.mc6_us /= topo.num_cores; | 1377 | average.cores.mc6_us /= topo.num_cores; |
1359 | 1378 | ||
1360 | if (do_skl_residency) { | 1379 | if (DO_BIC(BIC_Totl_c0)) |
1361 | average.packages.pkg_wtd_core_c0 /= topo.num_packages; | 1380 | average.packages.pkg_wtd_core_c0 /= topo.num_packages; |
1381 | if (DO_BIC(BIC_Any_c0)) | ||
1362 | average.packages.pkg_any_core_c0 /= topo.num_packages; | 1382 | average.packages.pkg_any_core_c0 /= topo.num_packages; |
1383 | if (DO_BIC(BIC_GFX_c0)) | ||
1363 | average.packages.pkg_any_gfxe_c0 /= topo.num_packages; | 1384 | average.packages.pkg_any_gfxe_c0 /= topo.num_packages; |
1385 | if (DO_BIC(BIC_CPUGFX)) | ||
1364 | average.packages.pkg_both_core_gfxe_c0 /= topo.num_packages; | 1386 | average.packages.pkg_both_core_gfxe_c0 /= topo.num_packages; |
1365 | } | ||
1366 | 1387 | ||
1367 | average.packages.pc2 /= topo.num_packages; | 1388 | average.packages.pc2 /= topo.num_packages; |
1368 | if (DO_BIC(BIC_Pkgpc3)) | 1389 | if (DO_BIC(BIC_Pkgpc3)) |
@@ -1603,13 +1624,19 @@ retry: | |||
1603 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) | 1624 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) |
1604 | return 0; | 1625 | return 0; |
1605 | 1626 | ||
1606 | if (do_skl_residency) { | 1627 | if (DO_BIC(BIC_Totl_c0)) { |
1607 | if (get_msr(cpu, MSR_PKG_WEIGHTED_CORE_C0_RES, &p->pkg_wtd_core_c0)) | 1628 | if (get_msr(cpu, MSR_PKG_WEIGHTED_CORE_C0_RES, &p->pkg_wtd_core_c0)) |
1608 | return -10; | 1629 | return -10; |
1630 | } | ||
1631 | if (DO_BIC(BIC_Any_c0)) { | ||
1609 | if (get_msr(cpu, MSR_PKG_ANY_CORE_C0_RES, &p->pkg_any_core_c0)) | 1632 | if (get_msr(cpu, MSR_PKG_ANY_CORE_C0_RES, &p->pkg_any_core_c0)) |
1610 | return -11; | 1633 | return -11; |
1634 | } | ||
1635 | if (DO_BIC(BIC_GFX_c0)) { | ||
1611 | if (get_msr(cpu, MSR_PKG_ANY_GFXE_C0_RES, &p->pkg_any_gfxe_c0)) | 1636 | if (get_msr(cpu, MSR_PKG_ANY_GFXE_C0_RES, &p->pkg_any_gfxe_c0)) |
1612 | return -12; | 1637 | return -12; |
1638 | } | ||
1639 | if (DO_BIC(BIC_CPUGFX)) { | ||
1613 | if (get_msr(cpu, MSR_PKG_BOTH_CORE_GFXE_C0_RES, &p->pkg_both_core_gfxe_c0)) | 1640 | if (get_msr(cpu, MSR_PKG_BOTH_CORE_GFXE_C0_RES, &p->pkg_both_core_gfxe_c0)) |
1614 | return -13; | 1641 | return -13; |
1615 | } | 1642 | } |
@@ -4198,7 +4225,12 @@ void process_cpuid() | |||
4198 | BIC_PRESENT(BIC_Pkgpc10); | 4225 | BIC_PRESENT(BIC_Pkgpc10); |
4199 | } | 4226 | } |
4200 | do_irtl_hsw = has_hsw_msrs(family, model); | 4227 | do_irtl_hsw = has_hsw_msrs(family, model); |
4201 | do_skl_residency = has_skl_msrs(family, model); | 4228 | if (has_skl_msrs(family, model)) { |
4229 | BIC_PRESENT(BIC_Totl_c0); | ||
4230 | BIC_PRESENT(BIC_Any_c0); | ||
4231 | BIC_PRESENT(BIC_GFX_c0); | ||
4232 | BIC_PRESENT(BIC_CPUGFX); | ||
4233 | } | ||
4202 | do_slm_cstates = is_slm(family, model); | 4234 | do_slm_cstates = is_slm(family, model); |
4203 | do_knl_cstates = is_knl(family, model); | 4235 | do_knl_cstates = is_knl(family, model); |
4204 | 4236 | ||