Commit 96718ad2 authored by Len Brown's avatar Len Brown
Browse files

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: default avatarLen Brown <len.brown@intel.com>
parent 8e5c0cc3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ The column name "all" can be used to enable all disabled-by-default built-in cou
.PP
\fB--num_iterations num\fP number of the measurement iterations.
.PP
\fB--header_iterations num\fP print header every num iterations.
.PP
\fB--out output_file\fP turbostat output is written to the specified output_file.
The file is truncated if it already exists, and it is created if it does not exist.
.PP
+9 −11
Original line number Diff line number Diff line
@@ -11443,7 +11443,7 @@ void cmdline(int argc, char **argv)
	 * Parse some options early, because they may make other options invalid,
	 * like adding the MSR counter with --add and at the same time using --no-msr.
	 */
	while ((opt = getopt_long_only(argc, argv, "+MPn:", long_options, &option_index)) != -1) {
	while ((opt = getopt_long_only(argc, argv, "+:MP", long_options, &option_index)) != -1) {
		switch (opt) {
		case 'M':
			no_msr = 1;
@@ -11457,7 +11457,7 @@ void cmdline(int argc, char **argv)
	}
	optind = 0;

	while ((opt = getopt_long_only(argc, argv, "+C:c:Dde:hi:Jn:o:qMST:v", long_options, &option_index)) != -1) {
	while ((opt = getopt_long_only(argc, argv, "+C:c:Dde:hi:Jn:N:o:qMST:v", long_options, &option_index)) != -1) {
		switch (opt) {
		case 'a':
			parse_add_command(optarg);
@@ -11500,7 +11500,6 @@ void cmdline(int argc, char **argv)
			}
			break;
		case 'h':
		default:
			help();
			exit(1);
		case 'i':
@@ -11539,19 +11538,15 @@ void cmdline(int argc, char **argv)
			num_iterations = strtoul(optarg, NULL, 0);
			errno = 0;

			if (errno || num_iterations == 0) {
				fprintf(outf, "invalid iteration count: %s\n", optarg);
				exit(2);
			}
			if (errno || num_iterations == 0)
				errx(-1, "invalid iteration count: %s", optarg);
			break;
		case 'N':
			header_iterations = strtoul(optarg, NULL, 0);
			errno = 0;

			if (errno || header_iterations == 0) {
				fprintf(outf, "invalid header iteration count: %s\n", optarg);
				exit(2);
			}
			if (errno || header_iterations == 0)
				errx(-1, "invalid header iteration count: %s", optarg);
			break;
		case 's':
			/*
@@ -11574,6 +11569,9 @@ void cmdline(int argc, char **argv)
			print_version();
			exit(0);
			break;
		default:
			help();
			exit(1);
		}
	}
}