aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
authorTom Zanussi <tzanussi@gmail.com>2009-12-15 03:53:35 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-15 04:31:31 -0500
commit586bc5cce88be993dad584c3936c49f945368551 (patch)
treef335951b59c1106918ced48a6e1242e131808225 /tools/perf/builtin-trace.c
parentc249a4ce796b30b742bb4854bf3039ced12ef8e5 (diff)
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.c19
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 @@
12static char const *script_name; 12static char const *script_name;
13static char const *generate_script_lang; 13static char const *generate_script_lang;
14 14
15static int default_start_script(const char *script __attribute((unused))) 15static int default_start_script(const char *script __unused,
16 int argc __unused,
17 const char **argv __unused)
16{ 18{
17 return 0; 19 return 0;
18} 20}
@@ -22,7 +24,7 @@ static int default_stop_script(void)
22 return 0; 24 return 0;
23} 25}
24 26
25static int default_generate_script(const char *outfile __attribute ((unused))) 27static int default_generate_script(const char *outfile __unused)
26{ 28{
27 return 0; 29 return 0;
28} 30}
@@ -302,15 +304,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
302 304
303 setup_scripting(); 305 setup_scripting();
304 306
305 argc = parse_options(argc, argv, options, annotate_usage, 0); 307 argc = parse_options(argc, argv, options, annotate_usage,
306 if (argc) { 308 PARSE_OPT_STOP_AT_NON_OPTION);
307 /*
308 * Special case: if there's an argument left then assume tha
309 * it's a symbol filter:
310 */
311 if (argc > 1)
312 usage_with_options(annotate_usage, options);
313 }
314 309
315 setup_pager(); 310 setup_pager();
316 311
@@ -350,7 +345,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
350 } 345 }
351 346
352 if (script_name) { 347 if (script_name) {
353 err = scripting_ops->start_script(script_name); 348 err = scripting_ops->start_script(script_name, argc, argv);
354 if (err) 349 if (err)
355 goto out; 350 goto out;
356 } 351 }