]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
perf_counter: Improve perf stat and perf record option parsing
authorAnton Blanchard <anton@samba.org>
Wed, 22 Jul 2009 13:04:12 +0000 (23:04 +1000)
committerPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 22 Jul 2009 16:05:56 +0000 (18:05 +0200)
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>

tools/perf/builtin-record.c
tools/perf/builtin-stat.c

index 68a9be0d1513760a9dad9f938473566544ce7885..6da09928130f8b726446e21e55b4a114a02926dd 100644 (file)
@@ -664,7 +664,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 {
        int counter;
 
-       argc = parse_options(argc, argv, options, record_usage, 0);
+       argc = parse_options(argc, argv, options, record_usage,
+               PARSE_OPT_STOP_AT_NON_OPTION);
        if (!argc && target_pid == -1 && !system_wide)
                usage_with_options(record_usage, options);
 
index 27921a8ce1a9ae34a4074d7694a184802351b648..f9510eeeb6c7a3f7e832abecbc77d102644c6141 100644 (file)
@@ -511,7 +511,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
 {
        int status;
 
-       argc = parse_options(argc, argv, options, stat_usage, 0);
+       argc = parse_options(argc, argv, options, stat_usage,
+               PARSE_OPT_STOP_AT_NON_OPTION);
        if (!argc)
                usage_with_options(stat_usage, options);
        if (run_count <= 0 || run_count > MAX_RUN)