]> Pileus Git - ~andy/linux/blobdiff - tools/power/x86/turbostat/turbostat.c
Merge branches 'acpi', 'idle', 'mrst-pmu' and 'pm-tools' into next
[~andy/linux] / tools / power / x86 / turbostat / turbostat.c
index 6d8ef4a3a9b5bd017a805a86ad2e3fd5737ca8e0..3c6f7808efae53b84cab8926f87b3a5f37ea60ee 100644 (file)
@@ -128,53 +128,55 @@ unsigned long long get_msr(int cpu, off_t offset)
 void print_header(void)
 {
        if (show_pkg)
-               fprintf(stderr, "pk");
+               fprintf(stderr, "pk");
        if (show_core)
-               fprintf(stderr, "core");
+               fprintf(stderr, " cr");
        if (show_cpu)
                fprintf(stderr, " CPU");
        if (do_nhm_cstates)
-               fprintf(stderr, "   %%c0 ");
+               fprintf(stderr, "    %%c0 ");
        if (has_aperf)
-               fprintf(stderr, "  GHz");
+               fprintf(stderr, " GHz");
        fprintf(stderr, "  TSC");
        if (do_nhm_cstates)
-               fprintf(stderr, "   %%c1 ");
+               fprintf(stderr, "    %%c1");
        if (do_nhm_cstates)
-               fprintf(stderr, "   %%c3 ");
+               fprintf(stderr, "    %%c3");
        if (do_nhm_cstates)
-               fprintf(stderr, "   %%c6 ");
+               fprintf(stderr, "    %%c6");
        if (do_snb_cstates)
-               fprintf(stderr, "   %%c7 ");
+               fprintf(stderr, "    %%c7");
        if (do_snb_cstates)
-               fprintf(stderr, "  %%pc2 ");
+               fprintf(stderr, "  %%pc2");
        if (do_nhm_cstates)
-               fprintf(stderr, "  %%pc3 ");
+               fprintf(stderr, "  %%pc3");
        if (do_nhm_cstates)
-               fprintf(stderr, "  %%pc6 ");
+               fprintf(stderr, "  %%pc6");
        if (do_snb_cstates)
-               fprintf(stderr, "  %%pc7 ");
+               fprintf(stderr, "  %%pc7");
        if (extra_msr_offset)
-               fprintf(stderr, "       MSR 0x%x ", extra_msr_offset);
+               fprintf(stderr, "        MSR 0x%x ", extra_msr_offset);
 
        putc('\n', stderr);
 }
 
 void dump_cnt(struct counters *cnt)
 {
-       fprintf(stderr, "package: %d ", cnt->pkg);
-       fprintf(stderr, "core:: %d ", cnt->core);
-       fprintf(stderr, "CPU: %d ", cnt->cpu);
-       fprintf(stderr, "TSC: %016llX\n", cnt->tsc);
-       fprintf(stderr, "c3: %016llX\n", cnt->c3);
-       fprintf(stderr, "c6: %016llX\n", cnt->c6);
-       fprintf(stderr, "c7: %016llX\n", cnt->c7);
-       fprintf(stderr, "aperf: %016llX\n", cnt->aperf);
-       fprintf(stderr, "pc2: %016llX\n", cnt->pc2);
-       fprintf(stderr, "pc3: %016llX\n", cnt->pc3);
-       fprintf(stderr, "pc6: %016llX\n", cnt->pc6);
-       fprintf(stderr, "pc7: %016llX\n", cnt->pc7);
-       fprintf(stderr, "msr0x%x: %016llX\n", extra_msr_offset, cnt->extra_msr);
+       if (!cnt)
+               return;
+       if (cnt->pkg) fprintf(stderr, "package: %d ", cnt->pkg);
+       if (cnt->core) fprintf(stderr, "core:: %d ", cnt->core);
+       if (cnt->cpu) fprintf(stderr, "CPU: %d ", cnt->cpu);
+       if (cnt->tsc) fprintf(stderr, "TSC: %016llX\n", cnt->tsc);
+       if (cnt->c3) fprintf(stderr, "c3: %016llX\n", cnt->c3);
+       if (cnt->c6) fprintf(stderr, "c6: %016llX\n", cnt->c6);
+       if (cnt->c7) fprintf(stderr, "c7: %016llX\n", cnt->c7);
+       if (cnt->aperf) fprintf(stderr, "aperf: %016llX\n", cnt->aperf);
+       if (cnt->pc2) fprintf(stderr, "pc2: %016llX\n", cnt->pc2);
+       if (cnt->pc3) fprintf(stderr, "pc3: %016llX\n", cnt->pc3);
+       if (cnt->pc6) fprintf(stderr, "pc6: %016llX\n", cnt->pc6);
+       if (cnt->pc7) fprintf(stderr, "pc7: %016llX\n", cnt->pc7);
+       if (cnt->extra_msr) fprintf(stderr, "msr0x%x: %016llX\n", extra_msr_offset, cnt->extra_msr);
 }
 
 void dump_list(struct counters *cnt)
@@ -194,14 +196,14 @@ void print_cnt(struct counters *p)
        /* topology columns, print blanks on 1st (average) line */
        if (p == cnt_average) {
                if (show_pkg)
-                       fprintf(stderr, "    ");
+                       fprintf(stderr, " ");
                if (show_core)
                        fprintf(stderr, "    ");
                if (show_cpu)
                        fprintf(stderr, "    ");
        } else {
                if (show_pkg)
-                       fprintf(stderr, "%4d", p->pkg);
+                       fprintf(stderr, "%d", p->pkg);
                if (show_core)
                        fprintf(stderr, "%4d", p->core);
                if (show_cpu)
@@ -241,22 +243,22 @@ void print_cnt(struct counters *p)
                if (!skip_c1)
                        fprintf(stderr, "%7.2f", 100.0 * p->c1/p->tsc);
                else
-                       fprintf(stderr, "   ****");
+                       fprintf(stderr, "  ****");
        }
        if (do_nhm_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->c3/p->tsc);
+               fprintf(stderr, " %6.2f", 100.0 * p->c3/p->tsc);
        if (do_nhm_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->c6/p->tsc);
+               fprintf(stderr, " %6.2f", 100.0 * p->c6/p->tsc);
        if (do_snb_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->c7/p->tsc);
+               fprintf(stderr, " %6.2f", 100.0 * p->c7/p->tsc);
        if (do_snb_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->pc2/p->tsc);
+               fprintf(stderr, " %5.2f", 100.0 * p->pc2/p->tsc);
        if (do_nhm_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->pc3/p->tsc);
+               fprintf(stderr, " %5.2f", 100.0 * p->pc3/p->tsc);
        if (do_nhm_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->pc6/p->tsc);
+               fprintf(stderr, " %5.2f", 100.0 * p->pc6/p->tsc);
        if (do_snb_cstates)
-               fprintf(stderr, "%7.2f", 100.0 * p->pc7/p->tsc);
+               fprintf(stderr, " %5.2f", 100.0 * p->pc7/p->tsc);
        if (extra_msr_offset)
                fprintf(stderr, "  0x%016llx", p->extra_msr);
        putc('\n', stderr);