diff options
author | Jiri Olsa <jolsa@redhat.com> | 2015-11-26 12:55:21 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-11-26 14:06:16 -0500 |
commit | 809e9423d7bc72e50d94d8267bab010a007a6137 (patch) | |
tree | bf0448096c0a99be760e00ffaf59dd1c4b298fe0 /tools/perf/builtin-script.c | |
parent | b2be5451f660e0ee230969cc24121d9e210a91de (diff) |
perf script: Pass perf_script into process_event
Passing perf_script struct into process_event function, so we could
process configuration data for event printing.
It will be used in following patch to get event name string width.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20151126175521.GA18979@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 8e3f8048d2d0..3c3f8d0e3064 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -588,8 +588,17 @@ static void print_sample_flags(u32 flags) | |||
588 | printf(" %-4s ", str); | 588 | printf(" %-4s ", str); |
589 | } | 589 | } |
590 | 590 | ||
591 | static void process_event(union perf_event *event, struct perf_sample *sample, | 591 | struct perf_script { |
592 | struct perf_evsel *evsel, struct addr_location *al) | 592 | struct perf_tool tool; |
593 | struct perf_session *session; | ||
594 | bool show_task_events; | ||
595 | bool show_mmap_events; | ||
596 | bool show_switch_events; | ||
597 | }; | ||
598 | |||
599 | static void process_event(struct perf_script *script __maybe_unused, union perf_event *event, | ||
600 | struct perf_sample *sample, struct perf_evsel *evsel, | ||
601 | struct addr_location *al) | ||
593 | { | 602 | { |
594 | struct thread *thread = al->thread; | 603 | struct thread *thread = al->thread; |
595 | struct perf_event_attr *attr = &evsel->attr; | 604 | struct perf_event_attr *attr = &evsel->attr; |
@@ -663,12 +672,13 @@ static int cleanup_scripting(void) | |||
663 | return scripting_ops ? scripting_ops->stop_script() : 0; | 672 | return scripting_ops ? scripting_ops->stop_script() : 0; |
664 | } | 673 | } |
665 | 674 | ||
666 | static int process_sample_event(struct perf_tool *tool __maybe_unused, | 675 | static int process_sample_event(struct perf_tool *tool, |
667 | union perf_event *event, | 676 | union perf_event *event, |
668 | struct perf_sample *sample, | 677 | struct perf_sample *sample, |
669 | struct perf_evsel *evsel, | 678 | struct perf_evsel *evsel, |
670 | struct machine *machine) | 679 | struct machine *machine) |
671 | { | 680 | { |
681 | struct perf_script *scr = container_of(tool, struct perf_script, tool); | ||
672 | struct addr_location al; | 682 | struct addr_location al; |
673 | 683 | ||
674 | if (debug_mode) { | 684 | if (debug_mode) { |
@@ -697,21 +707,13 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, | |||
697 | if (scripting_ops) | 707 | if (scripting_ops) |
698 | scripting_ops->process_event(event, sample, evsel, &al); | 708 | scripting_ops->process_event(event, sample, evsel, &al); |
699 | else | 709 | else |
700 | process_event(event, sample, evsel, &al); | 710 | process_event(scr, event, sample, evsel, &al); |
701 | 711 | ||
702 | out_put: | 712 | out_put: |
703 | addr_location__put(&al); | 713 | addr_location__put(&al); |
704 | return 0; | 714 | return 0; |
705 | } | 715 | } |
706 | 716 | ||
707 | struct perf_script { | ||
708 | struct perf_tool tool; | ||
709 | struct perf_session *session; | ||
710 | bool show_task_events; | ||
711 | bool show_mmap_events; | ||
712 | bool show_switch_events; | ||
713 | }; | ||
714 | |||
715 | static int process_attr(struct perf_tool *tool, union perf_event *event, | 717 | static int process_attr(struct perf_tool *tool, union perf_event *event, |
716 | struct perf_evlist **pevlist) | 718 | struct perf_evlist **pevlist) |
717 | { | 719 | { |