diff options
author | Len Brown <len.brown@intel.com> | 2017-02-16 23:07:51 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2017-03-01 00:14:23 -0500 |
commit | 6168c2e0fb5084d187aa8f3ec4093db5e161d4dc (patch) | |
tree | 69ffd6864d5bc06f1718464b9db8d70dbe9c4632 /tools | |
parent | 0de6c0df4ecc32ffaf064fea3a43846ba4474bd0 (diff) |
tools/power turbostat: update --list feature
Make it possible to take the entire un-edited output
from `turbostat --list` and feed it to "turbostat --show"
or "turbostat --hide".
To do this, the leading comma was removed
(no mater what columns are active)
and also they dynamic C-state "C1, C2, C3" etc are replaced
by the string "sysfs", which refers to them as a group.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 219 |
1 files changed, 113 insertions, 106 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index cafc6bba6539..851eaf06f358 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -474,33 +474,38 @@ unsigned long long bic_lookup(char *name_list) | |||
474 | void print_header(char *delim) | 474 | void print_header(char *delim) |
475 | { | 475 | { |
476 | struct msr_counter *mp; | 476 | struct msr_counter *mp; |
477 | int printed = 0; | ||
477 | 478 | ||
478 | if (DO_BIC(BIC_Package)) | 479 | if (DO_BIC(BIC_Package)) |
479 | outp += sprintf(outp, "%sPackage", delim); | 480 | outp += sprintf(outp, "%sPackage", (printed++ ? delim : "")); |
480 | if (DO_BIC(BIC_Core)) | 481 | if (DO_BIC(BIC_Core)) |
481 | outp += sprintf(outp, "%sCore", delim); | 482 | outp += sprintf(outp, "%sCore", (printed++ ? delim : "")); |
482 | if (DO_BIC(BIC_CPU)) | 483 | if (DO_BIC(BIC_CPU)) |
483 | outp += sprintf(outp, "%sCPU", delim); | 484 | outp += sprintf(outp, "%sCPU", (printed++ ? delim : "")); |
484 | if (DO_BIC(BIC_Avg_MHz)) | 485 | if (DO_BIC(BIC_Avg_MHz)) |
485 | outp += sprintf(outp, "%sAvg_MHz", delim); | 486 | outp += sprintf(outp, "%sAvg_MHz", (printed++ ? delim : "")); |
486 | if (DO_BIC(BIC_Busy)) | 487 | if (DO_BIC(BIC_Busy)) |
487 | outp += sprintf(outp, "%sBusy%%", delim); | 488 | outp += sprintf(outp, "%sBusy%%", (printed++ ? delim : "")); |
488 | if (DO_BIC(BIC_Bzy_MHz)) | 489 | if (DO_BIC(BIC_Bzy_MHz)) |
489 | outp += sprintf(outp, "%sBzy_MHz", delim); | 490 | outp += sprintf(outp, "%sBzy_MHz", (printed++ ? delim : "")); |
490 | if (DO_BIC(BIC_TSC_MHz)) | 491 | if (DO_BIC(BIC_TSC_MHz)) |
491 | outp += sprintf(outp, "%sTSC_MHz", delim); | 492 | outp += sprintf(outp, "%sTSC_MHz", (printed++ ? delim : "")); |
492 | 493 | ||
493 | if (DO_BIC(BIC_IRQ)) { | 494 | if (DO_BIC(BIC_IRQ)) { |
494 | if (sums_need_wide_columns) | 495 | if (sums_need_wide_columns) |
495 | outp += sprintf(outp, "%s IRQ", delim); | 496 | outp += sprintf(outp, "%s IRQ", (printed++ ? delim : "")); |
496 | else | 497 | else |
497 | outp += sprintf(outp, "%sIRQ", delim); | 498 | outp += sprintf(outp, "%sIRQ", (printed++ ? delim : "")); |
498 | } | 499 | } |
499 | 500 | ||
500 | if (DO_BIC(BIC_SMI)) | 501 | if (DO_BIC(BIC_SMI)) |
501 | outp += sprintf(outp, "%sSMI", delim); | 502 | outp += sprintf(outp, "%sSMI", (printed++ ? delim : "")); |
502 | 503 | ||
503 | for (mp = sys.tp; mp; mp = mp->next) { | 504 | for (mp = sys.tp; mp; mp = mp->next) { |
505 | if (*delim == ',') { | ||
506 | outp += sprintf(outp, "%s%s", (printed++ ? delim : ""), "sysfs"); | ||
507 | break; | ||
508 | } | ||
504 | if (mp->format == FORMAT_RAW) { | 509 | if (mp->format == FORMAT_RAW) { |
505 | if (mp->width == 64) | 510 | if (mp->width == 64) |
506 | outp += sprintf(outp, "%s%18.18s", delim, mp->name); | 511 | outp += sprintf(outp, "%s%18.18s", delim, mp->name); |
@@ -515,19 +520,19 @@ void print_header(char *delim) | |||
515 | } | 520 | } |
516 | 521 | ||
517 | if (DO_BIC(BIC_CPU_c1)) | 522 | if (DO_BIC(BIC_CPU_c1)) |
518 | outp += sprintf(outp, "%sCPU%%c1", delim); | 523 | outp += sprintf(outp, "%sCPU%%c1", (printed++ ? delim : "")); |
519 | if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates) | 524 | if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates) |
520 | outp += sprintf(outp, "%sCPU%%c3", delim); | 525 | outp += sprintf(outp, "%sCPU%%c3", (printed++ ? delim : "")); |
521 | if (DO_BIC(BIC_CPU_c6)) | 526 | if (DO_BIC(BIC_CPU_c6)) |
522 | outp += sprintf(outp, "%sCPU%%c6", delim); | 527 | outp += sprintf(outp, "%sCPU%%c6", (printed++ ? delim : "")); |
523 | if (DO_BIC(BIC_CPU_c7)) | 528 | if (DO_BIC(BIC_CPU_c7)) |
524 | outp += sprintf(outp, "%sCPU%%c7", delim); | 529 | outp += sprintf(outp, "%sCPU%%c7", (printed++ ? delim : "")); |
525 | 530 | ||
526 | if (DO_BIC(BIC_Mod_c6)) | 531 | if (DO_BIC(BIC_Mod_c6)) |
527 | outp += sprintf(outp, "%sMod%%c6", delim); | 532 | outp += sprintf(outp, "%sMod%%c6", (printed++ ? delim : "")); |
528 | 533 | ||
529 | if (DO_BIC(BIC_CoreTmp)) | 534 | if (DO_BIC(BIC_CoreTmp)) |
530 | outp += sprintf(outp, "%sCoreTmp", delim); | 535 | outp += sprintf(outp, "%sCoreTmp", (printed++ ? delim : "")); |
531 | 536 | ||
532 | for (mp = sys.cp; mp; mp = mp->next) { | 537 | for (mp = sys.cp; mp; mp = mp->next) { |
533 | if (mp->format == FORMAT_RAW) { | 538 | if (mp->format == FORMAT_RAW) { |
@@ -544,62 +549,62 @@ void print_header(char *delim) | |||
544 | } | 549 | } |
545 | 550 | ||
546 | if (DO_BIC(BIC_PkgTmp)) | 551 | if (DO_BIC(BIC_PkgTmp)) |
547 | outp += sprintf(outp, "%sPkgTmp", delim); | 552 | outp += sprintf(outp, "%sPkgTmp", (printed++ ? delim : "")); |
548 | 553 | ||
549 | if (DO_BIC(BIC_GFX_rc6)) | 554 | if (DO_BIC(BIC_GFX_rc6)) |
550 | outp += sprintf(outp, "%sGFX%%rc6", delim); | 555 | outp += sprintf(outp, "%sGFX%%rc6", (printed++ ? delim : "")); |
551 | 556 | ||
552 | if (DO_BIC(BIC_GFXMHz)) | 557 | if (DO_BIC(BIC_GFXMHz)) |
553 | outp += sprintf(outp, "%sGFXMHz", delim); | 558 | outp += sprintf(outp, "%sGFXMHz", (printed++ ? delim : "")); |
554 | 559 | ||
555 | if (do_skl_residency) { | 560 | if (do_skl_residency) { |
556 | outp += sprintf(outp, "%sTotl%%C0", delim); | 561 | outp += sprintf(outp, "%sTotl%%C0", (printed++ ? delim : "")); |
557 | outp += sprintf(outp, "%sAny%%C0", delim); | 562 | outp += sprintf(outp, "%sAny%%C0", (printed++ ? delim : "")); |
558 | outp += sprintf(outp, "%sGFX%%C0", delim); | 563 | outp += sprintf(outp, "%sGFX%%C0", (printed++ ? delim : "")); |
559 | outp += sprintf(outp, "%sCPUGFX%%", delim); | 564 | outp += sprintf(outp, "%sCPUGFX%%", (printed++ ? delim : "")); |
560 | } | 565 | } |
561 | 566 | ||
562 | if (DO_BIC(BIC_Pkgpc2)) | 567 | if (DO_BIC(BIC_Pkgpc2)) |
563 | outp += sprintf(outp, "%sPkg%%pc2", delim); | 568 | outp += sprintf(outp, "%sPkg%%pc2", (printed++ ? delim : "")); |
564 | if (DO_BIC(BIC_Pkgpc3)) | 569 | if (DO_BIC(BIC_Pkgpc3)) |
565 | outp += sprintf(outp, "%sPkg%%pc3", delim); | 570 | outp += sprintf(outp, "%sPkg%%pc3", (printed++ ? delim : "")); |
566 | if (DO_BIC(BIC_Pkgpc6)) | 571 | if (DO_BIC(BIC_Pkgpc6)) |
567 | outp += sprintf(outp, "%sPkg%%pc6", delim); | 572 | outp += sprintf(outp, "%sPkg%%pc6", (printed++ ? delim : "")); |
568 | if (DO_BIC(BIC_Pkgpc7)) | 573 | if (DO_BIC(BIC_Pkgpc7)) |
569 | outp += sprintf(outp, "%sPkg%%pc7", delim); | 574 | outp += sprintf(outp, "%sPkg%%pc7", (printed++ ? delim : "")); |
570 | if (DO_BIC(BIC_Pkgpc8)) | 575 | if (DO_BIC(BIC_Pkgpc8)) |
571 | outp += sprintf(outp, "%sPkg%%pc8", delim); | 576 | outp += sprintf(outp, "%sPkg%%pc8", (printed++ ? delim : "")); |
572 | if (DO_BIC(BIC_Pkgpc9)) | 577 | if (DO_BIC(BIC_Pkgpc9)) |
573 | outp += sprintf(outp, "%sPkg%%pc9", delim); | 578 | outp += sprintf(outp, "%sPkg%%pc9", (printed++ ? delim : "")); |
574 | if (DO_BIC(BIC_Pkgpc10)) | 579 | if (DO_BIC(BIC_Pkgpc10)) |
575 | outp += sprintf(outp, "%sPk%%pc10", delim); | 580 | outp += sprintf(outp, "%sPk%%pc10", (printed++ ? delim : "")); |
576 | 581 | ||
577 | if (do_rapl && !rapl_joules) { | 582 | if (do_rapl && !rapl_joules) { |
578 | if (DO_BIC(BIC_PkgWatt)) | 583 | if (DO_BIC(BIC_PkgWatt)) |
579 | outp += sprintf(outp, "%sPkgWatt", delim); | 584 | outp += sprintf(outp, "%sPkgWatt", (printed++ ? delim : "")); |
580 | if (DO_BIC(BIC_CorWatt)) | 585 | if (DO_BIC(BIC_CorWatt)) |
581 | outp += sprintf(outp, "%sCorWatt", delim); | 586 | outp += sprintf(outp, "%sCorWatt", (printed++ ? delim : "")); |
582 | if (DO_BIC(BIC_GFXWatt)) | 587 | if (DO_BIC(BIC_GFXWatt)) |
583 | outp += sprintf(outp, "%sGFXWatt", delim); | 588 | outp += sprintf(outp, "%sGFXWatt", (printed++ ? delim : "")); |
584 | if (DO_BIC(BIC_RAMWatt)) | 589 | if (DO_BIC(BIC_RAMWatt)) |
585 | outp += sprintf(outp, "%sRAMWatt", delim); | 590 | outp += sprintf(outp, "%sRAMWatt", (printed++ ? delim : "")); |
586 | if (DO_BIC(BIC_PKG__)) | 591 | if (DO_BIC(BIC_PKG__)) |
587 | outp += sprintf(outp, "%sPKG_%%", delim); | 592 | outp += sprintf(outp, "%sPKG_%%", (printed++ ? delim : "")); |
588 | if (DO_BIC(BIC_RAM__)) | 593 | if (DO_BIC(BIC_RAM__)) |
589 | outp += sprintf(outp, "%sRAM_%%", delim); | 594 | outp += sprintf(outp, "%sRAM_%%", (printed++ ? delim : "")); |
590 | } else if (do_rapl && rapl_joules) { | 595 | } else if (do_rapl && rapl_joules) { |
591 | if (DO_BIC(BIC_Pkg_J)) | 596 | if (DO_BIC(BIC_Pkg_J)) |
592 | outp += sprintf(outp, "%sPkg_J", delim); | 597 | outp += sprintf(outp, "%sPkg_J", (printed++ ? delim : "")); |
593 | if (DO_BIC(BIC_Cor_J)) | 598 | if (DO_BIC(BIC_Cor_J)) |
594 | outp += sprintf(outp, "%sCor_J", delim); | 599 | outp += sprintf(outp, "%sCor_J", (printed++ ? delim : "")); |
595 | if (DO_BIC(BIC_GFX_J)) | 600 | if (DO_BIC(BIC_GFX_J)) |
596 | outp += sprintf(outp, "%sGFX_J", delim); | 601 | outp += sprintf(outp, "%sGFX_J", (printed++ ? delim : "")); |
597 | if (DO_BIC(BIC_RAM_J)) | 602 | if (DO_BIC(BIC_RAM_J)) |
598 | outp += sprintf(outp, "%sRAM_J", delim); | 603 | outp += sprintf(outp, "%sRAM_J", (printed++ ? delim : "")); |
599 | if (DO_BIC(BIC_PKG__)) | 604 | if (DO_BIC(BIC_PKG__)) |
600 | outp += sprintf(outp, "%sPKG_%%", delim); | 605 | outp += sprintf(outp, "%sPKG_%%", (printed++ ? delim : "")); |
601 | if (DO_BIC(BIC_RAM__)) | 606 | if (DO_BIC(BIC_RAM__)) |
602 | outp += sprintf(outp, "%sRAM_%%", delim); | 607 | outp += sprintf(outp, "%sRAM_%%", (printed++ ? delim : "")); |
603 | } | 608 | } |
604 | for (mp = sys.pp; mp; mp = mp->next) { | 609 | for (mp = sys.pp; mp; mp = mp->next) { |
605 | if (mp->format == FORMAT_RAW) { | 610 | if (mp->format == FORMAT_RAW) { |
@@ -708,6 +713,8 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
708 | char *fmt8; | 713 | char *fmt8; |
709 | int i; | 714 | int i; |
710 | struct msr_counter *mp; | 715 | struct msr_counter *mp; |
716 | char *delim = "\t"; | ||
717 | int printed = 0; | ||
711 | 718 | ||
712 | /* if showing only 1st thread in core and this isn't one, bail out */ | 719 | /* if showing only 1st thread in core and this isn't one, bail out */ |
713 | if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 720 | if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
@@ -729,81 +736,81 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
729 | /* topo columns, print blanks on 1st (average) line */ | 736 | /* topo columns, print blanks on 1st (average) line */ |
730 | if (t == &average.threads) { | 737 | if (t == &average.threads) { |
731 | if (DO_BIC(BIC_Package)) | 738 | if (DO_BIC(BIC_Package)) |
732 | outp += sprintf(outp, "\t-"); | 739 | outp += sprintf(outp, "%s-", (printed++ ? delim : "")); |
733 | if (DO_BIC(BIC_Core)) | 740 | if (DO_BIC(BIC_Core)) |
734 | outp += sprintf(outp, "\t-"); | 741 | outp += sprintf(outp, "%s-", (printed++ ? delim : "")); |
735 | if (DO_BIC(BIC_CPU)) | 742 | if (DO_BIC(BIC_CPU)) |
736 | outp += sprintf(outp, "\t-"); | 743 | outp += sprintf(outp, "%s-", (printed++ ? delim : "")); |
737 | } else { | 744 | } else { |
738 | if (DO_BIC(BIC_Package)) { | 745 | if (DO_BIC(BIC_Package)) { |
739 | if (p) | 746 | if (p) |
740 | outp += sprintf(outp, "\t%d", p->package_id); | 747 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->package_id); |
741 | else | 748 | else |
742 | outp += sprintf(outp, "\t-"); | 749 | outp += sprintf(outp, "%s-", (printed++ ? delim : "")); |
743 | } | 750 | } |
744 | if (DO_BIC(BIC_Core)) { | 751 | if (DO_BIC(BIC_Core)) { |
745 | if (c) | 752 | if (c) |
746 | outp += sprintf(outp, "\t%d", c->core_id); | 753 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), c->core_id); |
747 | else | 754 | else |
748 | outp += sprintf(outp, "\t-"); | 755 | outp += sprintf(outp, "%s-", (printed++ ? delim : "")); |
749 | } | 756 | } |
750 | if (DO_BIC(BIC_CPU)) | 757 | if (DO_BIC(BIC_CPU)) |
751 | outp += sprintf(outp, "\t%d", t->cpu_id); | 758 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->cpu_id); |
752 | } | 759 | } |
753 | 760 | ||
754 | if (DO_BIC(BIC_Avg_MHz)) | 761 | if (DO_BIC(BIC_Avg_MHz)) |
755 | outp += sprintf(outp, "\t%.0f", | 762 | outp += sprintf(outp, "%s%.0f", (printed++ ? delim : ""), |
756 | 1.0 / units * t->aperf / interval_float); | 763 | 1.0 / units * t->aperf / interval_float); |
757 | 764 | ||
758 | if (DO_BIC(BIC_Busy)) | 765 | if (DO_BIC(BIC_Busy)) |
759 | outp += sprintf(outp, "\t%.2f", 100.0 * t->mperf/tsc); | 766 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * t->mperf/tsc); |
760 | 767 | ||
761 | if (DO_BIC(BIC_Bzy_MHz)) { | 768 | if (DO_BIC(BIC_Bzy_MHz)) { |
762 | if (has_base_hz) | 769 | if (has_base_hz) |
763 | outp += sprintf(outp, "\t%.0f", base_hz / units * t->aperf / t->mperf); | 770 | outp += sprintf(outp, "%s%.0f", (printed++ ? delim : ""), base_hz / units * t->aperf / t->mperf); |
764 | else | 771 | else |
765 | outp += sprintf(outp, "\t%.0f", | 772 | outp += sprintf(outp, "%s%.0f", (printed++ ? delim : ""), |
766 | tsc / units * t->aperf / t->mperf / interval_float); | 773 | tsc / units * t->aperf / t->mperf / interval_float); |
767 | } | 774 | } |
768 | 775 | ||
769 | if (DO_BIC(BIC_TSC_MHz)) | 776 | if (DO_BIC(BIC_TSC_MHz)) |
770 | outp += sprintf(outp, "\t%.0f", 1.0 * t->tsc/units/interval_float); | 777 | outp += sprintf(outp, "%s%.0f", (printed++ ? delim : ""), 1.0 * t->tsc/units/interval_float); |
771 | 778 | ||
772 | /* IRQ */ | 779 | /* IRQ */ |
773 | if (DO_BIC(BIC_IRQ)) { | 780 | if (DO_BIC(BIC_IRQ)) { |
774 | if (sums_need_wide_columns) | 781 | if (sums_need_wide_columns) |
775 | outp += sprintf(outp, "\t%8lld", t->irq_count); | 782 | outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), t->irq_count); |
776 | else | 783 | else |
777 | outp += sprintf(outp, "\t%lld", t->irq_count); | 784 | outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), t->irq_count); |
778 | } | 785 | } |
779 | 786 | ||
780 | /* SMI */ | 787 | /* SMI */ |
781 | if (DO_BIC(BIC_SMI)) | 788 | if (DO_BIC(BIC_SMI)) |
782 | outp += sprintf(outp, "\t%d", t->smi_count); | 789 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->smi_count); |
783 | 790 | ||
784 | /* Added counters */ | 791 | /* Added counters */ |
785 | for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) { | 792 | for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) { |
786 | if (mp->format == FORMAT_RAW) { | 793 | if (mp->format == FORMAT_RAW) { |
787 | if (mp->width == 32) | 794 | if (mp->width == 32) |
788 | outp += sprintf(outp, "\t0x%08lx", (unsigned long) t->counter[i]); | 795 | outp += sprintf(outp, "%s0x%08lx", (printed++ ? delim : ""), (unsigned long) t->counter[i]); |
789 | else | 796 | else |
790 | outp += sprintf(outp, "\t0x%016llx", t->counter[i]); | 797 | outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), t->counter[i]); |
791 | } else if (mp->format == FORMAT_DELTA) { | 798 | } else if (mp->format == FORMAT_DELTA) { |
792 | if ((mp->type == COUNTER_ITEMS) && sums_need_wide_columns) | 799 | if ((mp->type == COUNTER_ITEMS) && sums_need_wide_columns) |
793 | outp += sprintf(outp, "\t%8lld", t->counter[i]); | 800 | outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), t->counter[i]); |
794 | else | 801 | else |
795 | outp += sprintf(outp, "\t%lld", t->counter[i]); | 802 | outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), t->counter[i]); |
796 | } else if (mp->format == FORMAT_PERCENT) { | 803 | } else if (mp->format == FORMAT_PERCENT) { |
797 | if (mp->type == COUNTER_USEC) | 804 | if (mp->type == COUNTER_USEC) |
798 | outp += sprintf(outp, "\t%.2f", t->counter[i]/interval_float/10000); | 805 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), t->counter[i]/interval_float/10000); |
799 | else | 806 | else |
800 | outp += sprintf(outp, "\t%.2f", 100.0 * t->counter[i]/tsc); | 807 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * t->counter[i]/tsc); |
801 | } | 808 | } |
802 | } | 809 | } |
803 | 810 | ||
804 | /* C1 */ | 811 | /* C1 */ |
805 | if (DO_BIC(BIC_CPU_c1)) | 812 | if (DO_BIC(BIC_CPU_c1)) |
806 | outp += sprintf(outp, "\t%.2f", 100.0 * t->c1/tsc); | 813 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * t->c1/tsc); |
807 | 814 | ||
808 | 815 | ||
809 | /* print per-core data only for 1st thread in core */ | 816 | /* print per-core data only for 1st thread in core */ |
@@ -811,32 +818,32 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
811 | goto done; | 818 | goto done; |
812 | 819 | ||
813 | if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates) | 820 | if (DO_BIC(BIC_CPU_c3) && !do_slm_cstates && !do_knl_cstates) |
814 | outp += sprintf(outp, "\t%.2f", 100.0 * c->c3/tsc); | 821 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * c->c3/tsc); |
815 | if (DO_BIC(BIC_CPU_c6)) | 822 | if (DO_BIC(BIC_CPU_c6)) |
816 | outp += sprintf(outp, "\t%.2f", 100.0 * c->c6/tsc); | 823 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * c->c6/tsc); |
817 | if (DO_BIC(BIC_CPU_c7)) | 824 | if (DO_BIC(BIC_CPU_c7)) |
818 | outp += sprintf(outp, "\t%.2f", 100.0 * c->c7/tsc); | 825 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * c->c7/tsc); |
819 | 826 | ||
820 | /* Mod%c6 */ | 827 | /* Mod%c6 */ |
821 | if (DO_BIC(BIC_Mod_c6)) | 828 | if (DO_BIC(BIC_Mod_c6)) |
822 | outp += sprintf(outp, "\t%.2f", 100.0 * c->mc6_us / tsc); | 829 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * c->mc6_us / tsc); |
823 | 830 | ||
824 | if (DO_BIC(BIC_CoreTmp)) | 831 | if (DO_BIC(BIC_CoreTmp)) |
825 | outp += sprintf(outp, "\t%d", c->core_temp_c); | 832 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), c->core_temp_c); |
826 | 833 | ||
827 | for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) { | 834 | for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) { |
828 | if (mp->format == FORMAT_RAW) { | 835 | if (mp->format == FORMAT_RAW) { |
829 | if (mp->width == 32) | 836 | if (mp->width == 32) |
830 | outp += sprintf(outp, "\t0x%08lx", (unsigned long) c->counter[i]); | 837 | outp += sprintf(outp, "%s0x%08lx", (printed++ ? delim : ""), (unsigned long) c->counter[i]); |
831 | else | 838 | else |
832 | outp += sprintf(outp, "\t0x%016llx", c->counter[i]); | 839 | outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), c->counter[i]); |
833 | } else if (mp->format == FORMAT_DELTA) { | 840 | } else if (mp->format == FORMAT_DELTA) { |
834 | if ((mp->type == COUNTER_ITEMS) && sums_need_wide_columns) | 841 | if ((mp->type == COUNTER_ITEMS) && sums_need_wide_columns) |
835 | outp += sprintf(outp, "\t%8lld", c->counter[i]); | 842 | outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), c->counter[i]); |
836 | else | 843 | else |
837 | outp += sprintf(outp, "\t%lld", c->counter[i]); | 844 | outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), c->counter[i]); |
838 | } else if (mp->format == FORMAT_PERCENT) { | 845 | } else if (mp->format == FORMAT_PERCENT) { |
839 | outp += sprintf(outp, "\t%.2f", 100.0 * c->counter[i]/tsc); | 846 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * c->counter[i]/tsc); |
840 | } | 847 | } |
841 | } | 848 | } |
842 | 849 | ||
@@ -846,88 +853,88 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
846 | 853 | ||
847 | /* PkgTmp */ | 854 | /* PkgTmp */ |
848 | if (DO_BIC(BIC_PkgTmp)) | 855 | if (DO_BIC(BIC_PkgTmp)) |
849 | outp += sprintf(outp, "\t%d", p->pkg_temp_c); | 856 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->pkg_temp_c); |
850 | 857 | ||
851 | /* GFXrc6 */ | 858 | /* GFXrc6 */ |
852 | if (DO_BIC(BIC_GFX_rc6)) { | 859 | if (DO_BIC(BIC_GFX_rc6)) { |
853 | if (p->gfx_rc6_ms == -1) { /* detect GFX counter reset */ | 860 | if (p->gfx_rc6_ms == -1) { /* detect GFX counter reset */ |
854 | outp += sprintf(outp, "\t**.**"); | 861 | outp += sprintf(outp, "%s**.**", (printed++ ? delim : "")); |
855 | } else { | 862 | } else { |
856 | outp += sprintf(outp, "\t%.2f", | 863 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), |
857 | p->gfx_rc6_ms / 10.0 / interval_float); | 864 | p->gfx_rc6_ms / 10.0 / interval_float); |
858 | } | 865 | } |
859 | } | 866 | } |
860 | 867 | ||
861 | /* GFXMHz */ | 868 | /* GFXMHz */ |
862 | if (DO_BIC(BIC_GFXMHz)) | 869 | if (DO_BIC(BIC_GFXMHz)) |
863 | outp += sprintf(outp, "\t%d", p->gfx_mhz); | 870 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->gfx_mhz); |
864 | 871 | ||
865 | /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */ | 872 | /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */ |
866 | if (do_skl_residency) { | 873 | if (do_skl_residency) { |
867 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_wtd_core_c0/tsc); | 874 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_wtd_core_c0/tsc); |
868 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_any_core_c0/tsc); | 875 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_any_core_c0/tsc); |
869 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_any_gfxe_c0/tsc); | 876 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_any_gfxe_c0/tsc); |
870 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_both_core_gfxe_c0/tsc); | 877 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pkg_both_core_gfxe_c0/tsc); |
871 | } | 878 | } |
872 | 879 | ||
873 | if (DO_BIC(BIC_Pkgpc2)) | 880 | if (DO_BIC(BIC_Pkgpc2)) |
874 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc2/tsc); | 881 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc2/tsc); |
875 | if (DO_BIC(BIC_Pkgpc3)) | 882 | if (DO_BIC(BIC_Pkgpc3)) |
876 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc3/tsc); | 883 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc3/tsc); |
877 | if (DO_BIC(BIC_Pkgpc6)) | 884 | if (DO_BIC(BIC_Pkgpc6)) |
878 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc6/tsc); | 885 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc6/tsc); |
879 | if (DO_BIC(BIC_Pkgpc7)) | 886 | if (DO_BIC(BIC_Pkgpc7)) |
880 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc7/tsc); | 887 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc7/tsc); |
881 | if (DO_BIC(BIC_Pkgpc8)) | 888 | if (DO_BIC(BIC_Pkgpc8)) |
882 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc8/tsc); | 889 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc8/tsc); |
883 | if (DO_BIC(BIC_Pkgpc9)) | 890 | if (DO_BIC(BIC_Pkgpc9)) |
884 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc9/tsc); | 891 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc9/tsc); |
885 | if (DO_BIC(BIC_Pkgpc10)) | 892 | if (DO_BIC(BIC_Pkgpc10)) |
886 | outp += sprintf(outp, "\t%.2f", 100.0 * p->pc10/tsc); | 893 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->pc10/tsc); |
887 | 894 | ||
888 | /* | 895 | /* |
889 | * If measurement interval exceeds minimum RAPL Joule Counter range, | 896 | * If measurement interval exceeds minimum RAPL Joule Counter range, |
890 | * indicate that results are suspect by printing "**" in fraction place. | 897 | * indicate that results are suspect by printing "**" in fraction place. |
891 | */ | 898 | */ |
892 | if (interval_float < rapl_joule_counter_range) | 899 | if (interval_float < rapl_joule_counter_range) |
893 | fmt8 = "\t%.2f"; | 900 | fmt8 = "%s%.2f"; |
894 | else | 901 | else |
895 | fmt8 = "%6.0f**"; | 902 | fmt8 = "%6.0f**"; |
896 | 903 | ||
897 | if (DO_BIC(BIC_PkgWatt)) | 904 | if (DO_BIC(BIC_PkgWatt)) |
898 | outp += sprintf(outp, fmt8, p->energy_pkg * rapl_energy_units / interval_float); | 905 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_pkg * rapl_energy_units / interval_float); |
899 | if (DO_BIC(BIC_CorWatt)) | 906 | if (DO_BIC(BIC_CorWatt)) |
900 | outp += sprintf(outp, fmt8, p->energy_cores * rapl_energy_units / interval_float); | 907 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_cores * rapl_energy_units / interval_float); |
901 | if (DO_BIC(BIC_GFXWatt)) | 908 | if (DO_BIC(BIC_GFXWatt)) |
902 | outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units / interval_float); | 909 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_gfx * rapl_energy_units / interval_float); |
903 | if (DO_BIC(BIC_RAMWatt)) | 910 | if (DO_BIC(BIC_RAMWatt)) |
904 | outp += sprintf(outp, fmt8, p->energy_dram * rapl_dram_energy_units / interval_float); | 911 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_dram * rapl_dram_energy_units / interval_float); |
905 | if (DO_BIC(BIC_Pkg_J)) | 912 | if (DO_BIC(BIC_Pkg_J)) |
906 | outp += sprintf(outp, fmt8, p->energy_pkg * rapl_energy_units); | 913 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_pkg * rapl_energy_units); |
907 | if (DO_BIC(BIC_Cor_J)) | 914 | if (DO_BIC(BIC_Cor_J)) |
908 | outp += sprintf(outp, fmt8, p->energy_cores * rapl_energy_units); | 915 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_cores * rapl_energy_units); |
909 | if (DO_BIC(BIC_GFX_J)) | 916 | if (DO_BIC(BIC_GFX_J)) |
910 | outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units); | 917 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_gfx * rapl_energy_units); |
911 | if (DO_BIC(BIC_RAM_J)) | 918 | if (DO_BIC(BIC_RAM_J)) |
912 | outp += sprintf(outp, fmt8, p->energy_dram * rapl_dram_energy_units); | 919 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), p->energy_dram * rapl_dram_energy_units); |
913 | if (DO_BIC(BIC_PKG__)) | 920 | if (DO_BIC(BIC_PKG__)) |
914 | outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); | 921 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); |
915 | if (DO_BIC(BIC_RAM__)) | 922 | if (DO_BIC(BIC_RAM__)) |
916 | outp += sprintf(outp, fmt8, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); | 923 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); |
917 | 924 | ||
918 | for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) { | 925 | for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) { |
919 | if (mp->format == FORMAT_RAW) { | 926 | if (mp->format == FORMAT_RAW) { |
920 | if (mp->width == 32) | 927 | if (mp->width == 32) |
921 | outp += sprintf(outp, "\t0x%08lx", (unsigned long) p->counter[i]); | 928 | outp += sprintf(outp, "%s0x%08lx", (printed++ ? delim : ""), (unsigned long) p->counter[i]); |
922 | else | 929 | else |
923 | outp += sprintf(outp, "\t0x%016llx", p->counter[i]); | 930 | outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), p->counter[i]); |
924 | } else if (mp->format == FORMAT_DELTA) { | 931 | } else if (mp->format == FORMAT_DELTA) { |
925 | if ((mp->type == COUNTER_ITEMS) && sums_need_wide_columns) | 932 | if ((mp->type == COUNTER_ITEMS) && sums_need_wide_columns) |
926 | outp += sprintf(outp, "\t%8lld", p->counter[i]); | 933 | outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), p->counter[i]); |
927 | else | 934 | else |
928 | outp += sprintf(outp, "\t%lld", p->counter[i]); | 935 | outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), p->counter[i]); |
929 | } else if (mp->format == FORMAT_PERCENT) { | 936 | } else if (mp->format == FORMAT_PERCENT) { |
930 | outp += sprintf(outp, "\t%.2f", 100.0 * p->counter[i]/tsc); | 937 | outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * p->counter[i]/tsc); |
931 | } | 938 | } |
932 | } | 939 | } |
933 | 940 | ||