aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2009-07-22 09:04:12 -0400
committerPeter Zijlstra <a.p.zijlstra@chello.nl>2009-07-22 12:05:56 -0400
commita0541234f89c93f313961ce7b28676e11488a5f0 (patch)
treeb6006cad6fc36f60c8c027f4b6493a8cc686c37f /tools
parent7f453c24b95a085fc7bd35d53b33abc4dc5a048b (diff)
perf_counter: Improve perf stat and perf record option parsing
perf stat and perf record currently look for all options on the command line. This can lead to some confusion: # perf stat ls -l Error: unknown switch `l' While we can work around this by adding '--' before the command, the git option parsing code can stop at the first non option: # perf stat ls -l Performance counter stats for 'ls -l': .... Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <20090722130412.GD9029@kryten>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c3
-rw-r--r--tools/perf/builtin-stat.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 68a9be0d151..6da09928130 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -664,7 +664,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
664{ 664{
665 int counter; 665 int counter;
666 666
667 argc = parse_options(argc, argv, options, record_usage, 0); 667 argc = parse_options(argc, argv, options, record_usage,
668 PARSE_OPT_STOP_AT_NON_OPTION);
668 if (!argc && target_pid == -1 && !system_wide) 669 if (!argc && target_pid == -1 && !system_wide)
669 usage_with_options(record_usage, options); 670 usage_with_options(record_usage, options);
670 671
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 27921a8ce1a..f9510eeeb6c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -511,7 +511,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
511{ 511{
512 int status; 512 int status;
513 513
514 argc = parse_options(argc, argv, options, stat_usage, 0); 514 argc = parse_options(argc, argv, options, stat_usage,
515 PARSE_OPT_STOP_AT_NON_OPTION);
515 if (!argc) 516 if (!argc)
516 usage_with_options(stat_usage, options); 517 usage_with_options(stat_usage, options);
517 if (run_count <= 0 || run_count > MAX_RUN) 518 if (run_count <= 0 || run_count > MAX_RUN)