* [PATCH] perf_counter: Improve perf stat and perf record option parsing
@ 2009-07-22 13:04 Anton Blanchard
2009-07-22 13:08 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2009-07-22 13:04 UTC (permalink / raw)
To: a.p.zijlstra, mingo, paulus, fweisbec; +Cc: linux-kernel
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>
---
Index: linux.trees.git/tools/perf/builtin-record.c
===================================================================
--- linux.trees.git.orig/tools/perf/builtin-record.c 2009-07-22 22:43:35.000000000 +1000
+++ linux.trees.git/tools/perf/builtin-record.c 2009-07-22 22:43:40.000000000 +1000
@@ -664,7 +664,8 @@ int cmd_record(int argc, const char **ar
{
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: linux.trees.git/tools/perf/builtin-stat.c
===================================================================
--- linux.trees.git.orig/tools/perf/builtin-stat.c 2009-07-22 22:43:35.000000000 +1000
+++ linux.trees.git/tools/perf/builtin-stat.c 2009-07-22 22:43:40.000000000 +1000
@@ -511,7 +511,8 @@ int cmd_stat(int argc, const char **argv
{
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] perf_counter: Improve perf stat and perf record option parsing
2009-07-22 13:04 [PATCH] perf_counter: Improve perf stat and perf record option parsing Anton Blanchard
@ 2009-07-22 13:08 ` Peter Zijlstra
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2009-07-22 13:08 UTC (permalink / raw)
To: Anton Blanchard; +Cc: mingo, paulus, fweisbec, linux-kernel
On Wed, 2009-07-22 at 23:04 +1000, Anton Blanchard wrote:
> 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>
I queued it, thanks Anton.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-22 13:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-22 13:04 [PATCH] perf_counter: Improve perf stat and perf record option parsing Anton Blanchard
2009-07-22 13:08 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®