diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-08-15 15:08:37 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-08-22 12:12:11 -0400 |
commit | d445dd2a78eed884adf3b3426b078fe69d2516d8 (patch) | |
tree | 8c312a298537c1bfd9903e61807bd52f67e8687c /tools/perf/util | |
parent | d44bc558297222d9a621fff2eca3f880e91c49f7 (diff) |
perf scripting: Add 'flush' callback to scripting API
In order to defer some output via the scripting API, there needs to be a
callback after session processing but before the session is deleted.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1408129739-17368-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 6 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 6 | ||||
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 7 | ||||
-rw-r--r-- | tools/perf/util/trace-event.h | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index b2dba9c0a3a1..0a01bac4ce02 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -432,6 +432,11 @@ error: | |||
432 | return err; | 432 | return err; |
433 | } | 433 | } |
434 | 434 | ||
435 | static int perl_flush_script(void) | ||
436 | { | ||
437 | return 0; | ||
438 | } | ||
439 | |||
435 | /* | 440 | /* |
436 | * Stop trace script | 441 | * Stop trace script |
437 | */ | 442 | */ |
@@ -633,6 +638,7 @@ static int perl_generate_script(struct pevent *pevent, const char *outfile) | |||
633 | struct scripting_ops perl_scripting_ops = { | 638 | struct scripting_ops perl_scripting_ops = { |
634 | .name = "Perl", | 639 | .name = "Perl", |
635 | .start_script = perl_start_script, | 640 | .start_script = perl_start_script, |
641 | .flush_script = perl_flush_script, | ||
636 | .stop_script = perl_stop_script, | 642 | .stop_script = perl_stop_script, |
637 | .process_event = perl_process_event, | 643 | .process_event = perl_process_event, |
638 | .generate_script = perl_generate_script, | 644 | .generate_script = perl_generate_script, |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 26e5f14239ed..56ba07cce549 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -639,6 +639,11 @@ error: | |||
639 | return err; | 639 | return err; |
640 | } | 640 | } |
641 | 641 | ||
642 | static int python_flush_script(void) | ||
643 | { | ||
644 | return 0; | ||
645 | } | ||
646 | |||
642 | /* | 647 | /* |
643 | * Stop trace script | 648 | * Stop trace script |
644 | */ | 649 | */ |
@@ -823,6 +828,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) | |||
823 | struct scripting_ops python_scripting_ops = { | 828 | struct scripting_ops python_scripting_ops = { |
824 | .name = "Python", | 829 | .name = "Python", |
825 | .start_script = python_start_script, | 830 | .start_script = python_start_script, |
831 | .flush_script = python_flush_script, | ||
826 | .stop_script = python_stop_script, | 832 | .stop_script = python_stop_script, |
827 | .process_event = python_process_event, | 833 | .process_event = python_process_event, |
828 | .generate_script = python_generate_script, | 834 | .generate_script = python_generate_script, |
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index 57aaccc1692e..5c9bdd1591a9 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c | |||
@@ -30,6 +30,11 @@ | |||
30 | 30 | ||
31 | struct scripting_context *scripting_context; | 31 | struct scripting_context *scripting_context; |
32 | 32 | ||
33 | static int flush_script_unsupported(void) | ||
34 | { | ||
35 | return 0; | ||
36 | } | ||
37 | |||
33 | static int stop_script_unsupported(void) | 38 | static int stop_script_unsupported(void) |
34 | { | 39 | { |
35 | return 0; | 40 | return 0; |
@@ -74,6 +79,7 @@ static int python_generate_script_unsupported(struct pevent *pevent | |||
74 | struct scripting_ops python_scripting_unsupported_ops = { | 79 | struct scripting_ops python_scripting_unsupported_ops = { |
75 | .name = "Python", | 80 | .name = "Python", |
76 | .start_script = python_start_script_unsupported, | 81 | .start_script = python_start_script_unsupported, |
82 | .flush_script = flush_script_unsupported, | ||
77 | .stop_script = stop_script_unsupported, | 83 | .stop_script = stop_script_unsupported, |
78 | .process_event = process_event_unsupported, | 84 | .process_event = process_event_unsupported, |
79 | .generate_script = python_generate_script_unsupported, | 85 | .generate_script = python_generate_script_unsupported, |
@@ -137,6 +143,7 @@ static int perl_generate_script_unsupported(struct pevent *pevent | |||
137 | struct scripting_ops perl_scripting_unsupported_ops = { | 143 | struct scripting_ops perl_scripting_unsupported_ops = { |
138 | .name = "Perl", | 144 | .name = "Perl", |
139 | .start_script = perl_start_script_unsupported, | 145 | .start_script = perl_start_script_unsupported, |
146 | .flush_script = flush_script_unsupported, | ||
140 | .stop_script = stop_script_unsupported, | 147 | .stop_script = stop_script_unsupported, |
141 | .process_event = process_event_unsupported, | 148 | .process_event = process_event_unsupported, |
142 | .generate_script = perl_generate_script_unsupported, | 149 | .generate_script = perl_generate_script_unsupported, |
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index 7b6d68688327..52aaa19e1eb1 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h | |||
@@ -64,6 +64,7 @@ struct perf_session; | |||
64 | struct scripting_ops { | 64 | struct scripting_ops { |
65 | const char *name; | 65 | const char *name; |
66 | int (*start_script) (const char *script, int argc, const char **argv); | 66 | int (*start_script) (const char *script, int argc, const char **argv); |
67 | int (*flush_script) (void); | ||
67 | int (*stop_script) (void); | 68 | int (*stop_script) (void); |
68 | void (*process_event) (union perf_event *event, | 69 | void (*process_event) (union perf_event *event, |
69 | struct perf_sample *sample, | 70 | struct perf_sample *sample, |