diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2009-12-15 11:53:35 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-15 12:31:31 +0300 |
commit | 586bc5cce88be993dad584c3936c49f945368551 (patch) | |
tree | f335951b59c1106918ced48a6e1242e131808225 /tools/perf/builtin-trace.c | |
parent | c249a4ce796b30b742bb4854bf3039ced12ef8e5 (diff) | |
download | linux-586bc5cce88be993dad584c3936c49f945368551.tar.xz |
perf trace/scripting: Add support for script args
One oversight of the original scripting_ops patch was a lack of
support for passing args to handler scripts. This adds
argc/argv to the start_script() scripting_op, and changes the
rw-by-file script to take 'comm' arg rather than the 'perf'
value currently hard-coded. It also takes the opportunity to do
some related minor cleanup.
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: fweisbec@gmail.com
Cc: rostedt@goodmis.org
LKML-Reference: <1260867220-15699-2-git-send-email-tzanussi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 07da66511bd5..88b0353d4019 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -12,7 +12,9 @@ static char const *script_name; static char const *generate_script_lang; -static int default_start_script(const char *script __attribute((unused))) +static int default_start_script(const char *script __unused, + int argc __unused, + const char **argv __unused) { return 0; } @@ -22,7 +24,7 @@ static int default_stop_script(void) return 0; } -static int default_generate_script(const char *outfile __attribute ((unused))) +static int default_generate_script(const char *outfile __unused) { return 0; } @@ -302,15 +304,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) setup_scripting(); - argc = parse_options(argc, argv, options, annotate_usage, 0); - if (argc) { - /* - * Special case: if there's an argument left then assume tha - * it's a symbol filter: - */ - if (argc > 1) - usage_with_options(annotate_usage, options); - } + argc = parse_options(argc, argv, options, annotate_usage, + PARSE_OPT_STOP_AT_NON_OPTION); setup_pager(); @@ -350,7 +345,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) } if (script_name) { - err = scripting_ops->start_script(script_name); + err = scripting_ops->start_script(script_name, argc, argv); if (err) goto out; } |