Skip to content

Commit

Permalink
tools/power/turbostat: add option to count SMIs, re-name some options
Browse files Browse the repository at this point in the history
Counting SMIs is popular, so add a dedicated "-s" option to do it,
and juggle some of the other option letters.

-S is now system summary (was -s)
-c is 32 bit counter (was -d)
-C is 64-bit counter (was -D)
-p is 1st thread in core (was -c)
-P is 1st thread in package (was -p)

bump the minor version number

Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
lenb committed Oct 6, 2012
1 parent 8e180f3 commit f924081
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
12 changes: 7 additions & 5 deletions tools/power/x86/turbostat/turbostat.8
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ supports an "invariant" TSC, plus the APERF and MPERF MSRs.
on processors that additionally support C-state residency counters.

.SS Options
The \fB-s\fP option limits output to a 1-line system summary for each interval.
The \fB-p\fP option limits output to the 1st thread in 1st core of each package.
.PP
The \fB-c\fP option limits output to the 1st thread in each core.
The \fB-P\fP option limits output to the 1st thread in each Package.
.PP
The \fB-p\fP option limits output to the 1st thread in each package.
The \fB-S\fP option limits output to a 1-line System Summary for each interval.
.PP
The \fB-v\fP option increases verbosity.
.PP
The \fB-d MSR#\fP option includes the delta of the specified 32-bit MSR counter.
The \fB-s\fP option prints the SMI counter, equivalent to "-c 0x34"
.PP
The \fB-D MSR#\fP option includes the delta of the specified 64-bit MSR counter.
The \fB-c MSR#\fP option includes the delta of the specified 32-bit MSR counter.
.PP
The \fB-C MSR#\fP option includes the delta of the specified 64-bit MSR counter.
.PP
The \fB-m MSR#\fP option includes the the specified 32-bit MSR value.
.PP
Expand Down
23 changes: 13 additions & 10 deletions tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ void print_header(void)
outp += sprintf(outp, " GHz");
outp += sprintf(outp, " TSC");
if (extra_delta_offset32)
outp += sprintf(outp, " delta 0x%03X", extra_delta_offset32);
outp += sprintf(outp, " count 0x%03X", extra_delta_offset32);
if (extra_delta_offset64)
outp += sprintf(outp, " DELTA 0x%03X", extra_delta_offset64);
outp += sprintf(outp, " COUNT 0x%03X", extra_delta_offset64);
if (extra_msr_offset32)
outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset32);
if (extra_msr_offset64)
Expand Down Expand Up @@ -1304,7 +1304,7 @@ void check_cpuid()

void usage()
{
fprintf(stderr, "%s: [-v][-d MSR#][-D MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n",
fprintf(stderr, "%s: [-v][-p|-P|-S][-c MSR# | -s]][-C MSR#][-m MSR#][-M MSR#][-i interval_sec | command ...]\n",
progname);
exit(1);
}
Expand Down Expand Up @@ -1594,15 +1594,15 @@ void cmdline(int argc, char **argv)

progname = argv[0];

while ((opt = getopt(argc, argv, "+cpsvid:D:m:M:")) != -1) {
while ((opt = getopt(argc, argv, "+pPSvisc:sC:m:M:")) != -1) {
switch (opt) {
case 'c':
case 'p':
show_core_only++;
break;
case 'p':
case 'P':
show_pkg_only++;
break;
case 's':
case 'S':
summary_only++;
break;
case 'v':
Expand All @@ -1611,10 +1611,13 @@ void cmdline(int argc, char **argv)
case 'i':
interval_sec = atoi(optarg);
break;
case 'd':
case 'c':
sscanf(optarg, "%x", &extra_delta_offset32);
break;
case 'D':
case 's':
extra_delta_offset32 = 0x34; /* SMI counter */
break;
case 'C':
sscanf(optarg, "%x", &extra_delta_offset64);
break;
case 'm':
Expand All @@ -1634,7 +1637,7 @@ int main(int argc, char **argv)
cmdline(argc, argv);

if (verbose > 1)
fprintf(stderr, "turbostat v2.0 May 16, 2012"
fprintf(stderr, "turbostat v2.1 October 6, 2012"
" - Len Brown <[email protected]>\n");

turbostat_init();
Expand Down

0 comments on commit f924081

Please sign in to comment.