Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/power turbostat: Fix and document --header_iterations

The "header_iterations" option is commonly used to de-clutter
the screen of redundant header label rows in an interactive session:
Eg. every 10 rows:

$ sudo turbostat --header_iterations 10 -S -q -i 1

But --header_iterations was missing from turbostat.8

Also turbostat help advertised the "-N" short option
that did not actually work:

$ turbostat --help
-N, --header_iterations num
print header every num iterations

Repair "-N"
Document "--header_iterations" on turbostat.8

Signed-off-by: Len Brown <len.brown@intel.com>

Len Brown 96718ad2 8e5c0cc3

+12 -12
+3 -1
tools/power/x86/turbostat/turbostat.8
··· 111 111 .PP 112 112 \fB--no-perf\fP Disable all the uses of the perf API. 113 113 .PP 114 - \fB--force\fPForce turbostat to run on an unsupported platform (minimal defaults). 114 + \fB--force\fP Force turbostat to run on an unsupported platform (minimal defaults). 115 115 .PP 116 116 \fB--interval seconds\fP overrides the default 5.0 second measurement interval. 117 117 .PP 118 118 \fB--num_iterations num\fP number of the measurement iterations. 119 + .PP 120 + \fB--header_iterations num\fP print header every num iterations. 119 121 .PP 120 122 \fB--out output_file\fP turbostat output is written to the specified output_file. 121 123 The file is truncated if it already exists, and it is created if it does not exist.
+9 -11
tools/power/x86/turbostat/turbostat.c
··· 11443 11443 * Parse some options early, because they may make other options invalid, 11444 11444 * like adding the MSR counter with --add and at the same time using --no-msr. 11445 11445 */ 11446 - while ((opt = getopt_long_only(argc, argv, "+MPn:", long_options, &option_index)) != -1) { 11446 + while ((opt = getopt_long_only(argc, argv, "+:MP", long_options, &option_index)) != -1) { 11447 11447 switch (opt) { 11448 11448 case 'M': 11449 11449 no_msr = 1; ··· 11457 11457 } 11458 11458 optind = 0; 11459 11459 11460 - while ((opt = getopt_long_only(argc, argv, "+C:c:Dde:hi:Jn:o:qMST:v", long_options, &option_index)) != -1) { 11460 + while ((opt = getopt_long_only(argc, argv, "+C:c:Dde:hi:Jn:N:o:qMST:v", long_options, &option_index)) != -1) { 11461 11461 switch (opt) { 11462 11462 case 'a': 11463 11463 parse_add_command(optarg); ··· 11500 11500 } 11501 11501 break; 11502 11502 case 'h': 11503 - default: 11504 11503 help(); 11505 11504 exit(1); 11506 11505 case 'i': ··· 11538 11539 num_iterations = strtoul(optarg, NULL, 0); 11539 11540 errno = 0; 11540 11541 11541 - if (errno || num_iterations == 0) { 11542 - fprintf(outf, "invalid iteration count: %s\n", optarg); 11543 - exit(2); 11544 - } 11542 + if (errno || num_iterations == 0) 11543 + errx(-1, "invalid iteration count: %s", optarg); 11545 11544 break; 11546 11545 case 'N': 11547 11546 header_iterations = strtoul(optarg, NULL, 0); 11548 11547 errno = 0; 11549 11548 11550 - if (errno || header_iterations == 0) { 11551 - fprintf(outf, "invalid header iteration count: %s\n", optarg); 11552 - exit(2); 11553 - } 11549 + if (errno || header_iterations == 0) 11550 + errx(-1, "invalid header iteration count: %s", optarg); 11554 11551 break; 11555 11552 case 's': 11556 11553 /* ··· 11569 11574 print_version(); 11570 11575 exit(0); 11571 11576 break; 11577 + default: 11578 + help(); 11579 + exit(1); 11572 11580 } 11573 11581 } 11574 11582 }