aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2012-08-08 05:57:52 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-08 11:46:40 -0400
commit73994dc158a24df4af77d0a76c9702f120f7a6ad (patch)
tree26380804ed9dd1c8bc6e3d00459aaed01edd4d74 /tools/perf/builtin-script.c
parent6a6daec2ae9f097703c1da4925367f1c198c9492 (diff)
perf script: Replace "struct thread" with "struct addr_location" as a parameter for "process_event()"
Both perl and python script start processing events other than trace points, and it's useful to pass the resolved symbol and the dso info to the event handler in script for better analysis and statistics. Struct thread is already a member of struct addr_location, using addr_location will keep the thread info, while providing additional symbol and dso info if exist, so that the script itself doesn't need to bother to do the symbol resolving and dso searching work. Tested-by: David Ahern <dsahern@gmail.com> Signed-off-by: Feng Tang <feng.tang@intel.com> Acked-by: David Ahern <dsahern@gmail.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1344419875-21665-3-git-send-email-feng.tang@intel.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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 6425612b4d99..30a9cb8c9927 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -396,9 +396,10 @@ static void print_sample_bts(union perf_event *event,
396 396
397static void process_event(union perf_event *event, struct perf_sample *sample, 397static void process_event(union perf_event *event, struct perf_sample *sample,
398 struct perf_evsel *evsel, struct machine *machine, 398 struct perf_evsel *evsel, struct machine *machine,
399 struct thread *thread) 399 struct addr_location *al)
400{ 400{
401 struct perf_event_attr *attr = &evsel->attr; 401 struct perf_event_attr *attr = &evsel->attr;
402 struct thread *thread = al->thread;
402 403
403 if (output[attr->type].fields == 0) 404 if (output[attr->type].fields == 0)
404 return; 405 return;
@@ -511,7 +512,7 @@ static int process_sample_event(struct perf_tool *tool __used,
511 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) 512 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
512 return 0; 513 return 0;
513 514
514 scripting_ops->process_event(event, sample, evsel, machine, thread); 515 scripting_ops->process_event(event, sample, evsel, machine, &al);
515 516
516 evsel->hists.stats.total_period += sample->period; 517 evsel->hists.stats.total_period += sample->period;
517 return 0; 518 return 0;