diff options
| -rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 91 |
1 files changed, 66 insertions, 25 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 02afe35d8770..a83a37edc3da 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
| @@ -43,6 +43,7 @@ char *proc_stat = "/proc/stat"; | |||
| 43 | unsigned int interval_sec = 5; /* set with -i interval_sec */ | 43 | unsigned int interval_sec = 5; /* set with -i interval_sec */ |
| 44 | unsigned int verbose; /* set with -v */ | 44 | unsigned int verbose; /* set with -v */ |
| 45 | unsigned int rapl_verbose; /* set with -R */ | 45 | unsigned int rapl_verbose; /* set with -R */ |
| 46 | unsigned int rapl_joules; /* set with -J */ | ||
| 46 | unsigned int thermal_verbose; /* set with -T */ | 47 | unsigned int thermal_verbose; /* set with -T */ |
| 47 | unsigned int summary_only; /* set with -s */ | 48 | unsigned int summary_only; /* set with -s */ |
| 48 | unsigned int skip_c0; | 49 | unsigned int skip_c0; |
| @@ -317,19 +318,35 @@ void print_header(void) | |||
| 317 | outp += sprintf(outp, " %%pc10"); | 318 | outp += sprintf(outp, " %%pc10"); |
| 318 | } | 319 | } |
| 319 | 320 | ||
| 320 | if (do_rapl & RAPL_PKG) | 321 | if (do_rapl && !rapl_joules) { |
| 321 | outp += sprintf(outp, " Pkg_W"); | 322 | if (do_rapl & RAPL_PKG) |
| 322 | if (do_rapl & RAPL_CORES) | 323 | outp += sprintf(outp, " Pkg_W"); |
| 323 | outp += sprintf(outp, " Cor_W"); | 324 | if (do_rapl & RAPL_CORES) |
| 324 | if (do_rapl & RAPL_GFX) | 325 | outp += sprintf(outp, " Cor_W"); |
| 325 | outp += sprintf(outp, " GFX_W"); | 326 | if (do_rapl & RAPL_GFX) |
| 326 | if (do_rapl & RAPL_DRAM) | 327 | outp += sprintf(outp, " GFX_W"); |
| 327 | outp += sprintf(outp, " RAM_W"); | 328 | if (do_rapl & RAPL_DRAM) |
| 328 | if (do_rapl & RAPL_PKG_PERF_STATUS) | 329 | outp += sprintf(outp, " RAM_W"); |
| 329 | outp += sprintf(outp, " PKG_%%"); | 330 | if (do_rapl & RAPL_PKG_PERF_STATUS) |
| 330 | if (do_rapl & RAPL_DRAM_PERF_STATUS) | 331 | outp += sprintf(outp, " PKG_%%"); |
| 331 | outp += sprintf(outp, " RAM_%%"); | 332 | if (do_rapl & RAPL_DRAM_PERF_STATUS) |
| 333 | outp += sprintf(outp, " RAM_%%"); | ||
| 334 | } else { | ||
| 335 | if (do_rapl & RAPL_PKG) | ||
| 336 | outp += sprintf(outp, " Pkg_J"); | ||
| 337 | if (do_rapl & RAPL_CORES) | ||
| 338 | outp += sprintf(outp, " Cor_J"); | ||
| 339 | if (do_rapl & RAPL_GFX) | ||
| 340 | outp += sprintf(outp, " GFX_J"); | ||
| 341 | if (do_rapl & RAPL_DRAM) | ||
| 342 | outp += sprintf(outp, " RAM_W"); | ||
| 343 | if (do_rapl & RAPL_PKG_PERF_STATUS) | ||
| 344 | outp += sprintf(outp, " PKG_%%"); | ||
| 345 | if (do_rapl & RAPL_DRAM_PERF_STATUS) | ||
| 346 | outp += sprintf(outp, " RAM_%%"); | ||
| 347 | outp += sprintf(outp, " time"); | ||
| 332 | 348 | ||
| 349 | } | ||
| 333 | outp += sprintf(outp, "\n"); | 350 | outp += sprintf(outp, "\n"); |
| 334 | } | 351 | } |
| 335 | 352 | ||
| @@ -548,19 +565,39 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 548 | fmt6 = " %4.0f**"; | 565 | fmt6 = " %4.0f**"; |
| 549 | } | 566 | } |
| 550 | 567 | ||
| 551 | if (do_rapl & RAPL_PKG) | 568 | if (do_rapl && !rapl_joules) { |
| 552 | outp += sprintf(outp, fmt6, p->energy_pkg * rapl_energy_units / interval_float); | 569 | if (do_rapl & RAPL_PKG) |
| 553 | if (do_rapl & RAPL_CORES) | 570 | outp += sprintf(outp, fmt6, p->energy_pkg * rapl_energy_units / interval_float); |
| 554 | outp += sprintf(outp, fmt6, p->energy_cores * rapl_energy_units / interval_float); | 571 | if (do_rapl & RAPL_CORES) |
| 555 | if (do_rapl & RAPL_GFX) | 572 | outp += sprintf(outp, fmt6, p->energy_cores * rapl_energy_units / interval_float); |
| 556 | outp += sprintf(outp, fmt5, p->energy_gfx * rapl_energy_units / interval_float); | 573 | if (do_rapl & RAPL_GFX) |
| 557 | if (do_rapl & RAPL_DRAM) | 574 | outp += sprintf(outp, fmt5, p->energy_gfx * rapl_energy_units / interval_float); |
| 558 | outp += sprintf(outp, fmt5, p->energy_dram * rapl_energy_units / interval_float); | 575 | if (do_rapl & RAPL_DRAM) |
| 559 | if (do_rapl & RAPL_PKG_PERF_STATUS ) | 576 | outp += sprintf(outp, fmt5, p->energy_dram * rapl_energy_units / interval_float); |
| 560 | outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); | 577 | if (do_rapl & RAPL_PKG_PERF_STATUS) |
| 561 | if (do_rapl & RAPL_DRAM_PERF_STATUS ) | 578 | outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); |
| 562 | outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); | 579 | if (do_rapl & RAPL_DRAM_PERF_STATUS) |
| 580 | outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); | ||
| 581 | } else { | ||
| 582 | if (do_rapl & RAPL_PKG) | ||
| 583 | outp += sprintf(outp, fmt6, | ||
| 584 | p->energy_pkg * rapl_energy_units); | ||
| 585 | if (do_rapl & RAPL_CORES) | ||
| 586 | outp += sprintf(outp, fmt6, | ||
| 587 | p->energy_cores * rapl_energy_units); | ||
| 588 | if (do_rapl & RAPL_GFX) | ||
| 589 | outp += sprintf(outp, fmt5, | ||
| 590 | p->energy_gfx * rapl_energy_units); | ||
| 591 | if (do_rapl & RAPL_DRAM) | ||
| 592 | outp += sprintf(outp, fmt5, | ||
| 593 | p->energy_dram * rapl_energy_units); | ||
| 594 | if (do_rapl & RAPL_PKG_PERF_STATUS) | ||
| 595 | outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); | ||
| 596 | if (do_rapl & RAPL_DRAM_PERF_STATUS) | ||
| 597 | outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); | ||
| 598 | outp += sprintf(outp, fmt5, interval_float); | ||
| 563 | 599 | ||
| 600 | } | ||
| 564 | done: | 601 | done: |
| 565 | outp += sprintf(outp, "\n"); | 602 | outp += sprintf(outp, "\n"); |
| 566 | 603 | ||
| @@ -2340,7 +2377,7 @@ void cmdline(int argc, char **argv) | |||
| 2340 | 2377 | ||
| 2341 | progname = argv[0]; | 2378 | progname = argv[0]; |
| 2342 | 2379 | ||
| 2343 | while ((opt = getopt(argc, argv, "+pPSvi:sc:sC:m:M:RT:")) != -1) { | 2380 | while ((opt = getopt(argc, argv, "+pPSvi:sc:sC:m:M:RJT:")) != -1) { |
| 2344 | switch (opt) { | 2381 | switch (opt) { |
| 2345 | case 'p': | 2382 | case 'p': |
| 2346 | show_core_only++; | 2383 | show_core_only++; |
| @@ -2375,6 +2412,10 @@ void cmdline(int argc, char **argv) | |||
| 2375 | case 'T': | 2412 | case 'T': |
| 2376 | tcc_activation_temp_override = atoi(optarg); | 2413 | tcc_activation_temp_override = atoi(optarg); |
| 2377 | break; | 2414 | break; |
| 2415 | case 'J': | ||
| 2416 | rapl_joules++; | ||
| 2417 | break; | ||
| 2418 | |||
| 2378 | default: | 2419 | default: |
| 2379 | usage(); | 2420 | usage(); |
| 2380 | } | 2421 | } |
