Skip to content

Commit ebb5b26

Browse files
darcarilenb
authored andcommitted
tools/power turbostat: option '-n' is ambiguous
In some cases specifying the '-n' command line argument will cause turbostat to fail. For instance 'turbostat -n 1' works fine; however, 'turbostat -n 1 -d' will fail. This is the result of the first call to getopt_long_only() where "MP" is specified as the optstring. This can be easily fixed by changing the optstring from "MP" to "MPn:" to remove ambiguity between the arguments. tools/power turbostat: option '-n' is ambiguous; possibilities: '-num_iterations' '-no-msr' '-no-perf' Fixes: a0e86c9 ("tools/power turbostat: Add --no-perf option") Signed-off-by: David Arcari <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent f266106 commit ebb5b26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8424,7 +8424,7 @@ void cmdline(int argc, char **argv)
84248424
* Parse some options early, because they may make other options invalid,
84258425
* like adding the MSR counter with --add and at the same time using --no-msr.
84268426
*/
8427-
while ((opt = getopt_long_only(argc, argv, "MP", long_options, &option_index)) != -1) {
8427+
while ((opt = getopt_long_only(argc, argv, "MPn:", long_options, &option_index)) != -1) {
84288428
switch (opt) {
84298429
case 'M':
84308430
no_msr = 1;

0 commit comments

Comments
 (0)