aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-04-01 12:29:25 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-02 12:18:41 -0400
commitf9d5d549d2c2934be84b0bc7e5e034834459f591 (patch)
treebb6b9d6a430ac4933575bdc1e3912cf0553dc681
parent79628f2cfe0f488b23e5dc99a4a9a599032fa653 (diff)
perf scripting: No need to pass thread twice to the scripting callbacks
It is already in the addr_location, so remove the redundant 'thread' parameter from the callback signatures. Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1427906210-10519-3-git-send-email-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-script.c6
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c5
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c13
-rw-r--r--tools/perf/util/trace-event-scripting.c1
-rw-r--r--tools/perf/util/trace-event.h3
5 files changed, 11 insertions, 17 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c286b49c81b2..257dd066cb1a 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -446,9 +446,9 @@ static void print_sample_bts(union perf_event *event,
446} 446}
447 447
448static void process_event(union perf_event *event, struct perf_sample *sample, 448static void process_event(union perf_event *event, struct perf_sample *sample,
449 struct perf_evsel *evsel, struct thread *thread, 449 struct perf_evsel *evsel, struct addr_location *al)
450 struct addr_location *al)
451{ 450{
451 struct thread *thread = al->thread;
452 struct perf_event_attr *attr = &evsel->attr; 452 struct perf_event_attr *attr = &evsel->attr;
453 453
454 if (output[attr->type].fields == 0) 454 if (output[attr->type].fields == 0)
@@ -573,7 +573,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
573 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) 573 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
574 return 0; 574 return 0;
575 575
576 scripting_ops->process_event(event, sample, evsel, al.thread, &al); 576 scripting_ops->process_event(event, sample, evsel, &al);
577 577
578 return 0; 578 return 0;
579} 579}
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 8171fed4136e..430b5d27828e 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -360,10 +360,9 @@ static void perl_process_event_generic(union perf_event *event,
360static void perl_process_event(union perf_event *event, 360static void perl_process_event(union perf_event *event,
361 struct perf_sample *sample, 361 struct perf_sample *sample,
362 struct perf_evsel *evsel, 362 struct perf_evsel *evsel,
363 struct thread *thread, 363 struct addr_location *al)
364 struct addr_location *al __maybe_unused)
365{ 364{
366 perl_process_tracepoint(sample, evsel, thread); 365 perl_process_tracepoint(sample, evsel, al->thread);
367 perl_process_event_generic(event, sample, evsel); 366 perl_process_event_generic(event, sample, evsel);
368} 367}
369 368
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 2ec5dfb5a456..de8df1d5e1bd 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -381,7 +381,6 @@ exit:
381 381
382static void python_process_tracepoint(struct perf_sample *sample, 382static void python_process_tracepoint(struct perf_sample *sample,
383 struct perf_evsel *evsel, 383 struct perf_evsel *evsel,
384 struct thread *thread,
385 struct addr_location *al) 384 struct addr_location *al)
386{ 385{
387 struct event_format *event = evsel->tp_format; 386 struct event_format *event = evsel->tp_format;
@@ -395,7 +394,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
395 int cpu = sample->cpu; 394 int cpu = sample->cpu;
396 void *data = sample->raw_data; 395 void *data = sample->raw_data;
397 unsigned long long nsecs = sample->time; 396 unsigned long long nsecs = sample->time;
398 const char *comm = thread__comm_str(thread); 397 const char *comm = thread__comm_str(al->thread);
399 398
400 t = PyTuple_New(MAX_FIELDS); 399 t = PyTuple_New(MAX_FIELDS);
401 if (!t) 400 if (!t)
@@ -766,7 +765,6 @@ static int python_process_call_return(struct call_return *cr, void *data)
766 765
767static void python_process_general_event(struct perf_sample *sample, 766static void python_process_general_event(struct perf_sample *sample,
768 struct perf_evsel *evsel, 767 struct perf_evsel *evsel,
769 struct thread *thread,
770 struct addr_location *al) 768 struct addr_location *al)
771{ 769{
772 PyObject *handler, *t, *dict, *callchain, *dict_sample; 770 PyObject *handler, *t, *dict, *callchain, *dict_sample;
@@ -816,7 +814,7 @@ static void python_process_general_event(struct perf_sample *sample,
816 pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( 814 pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
817 (const char *)sample->raw_data, sample->raw_size)); 815 (const char *)sample->raw_data, sample->raw_size));
818 pydict_set_item_string_decref(dict, "comm", 816 pydict_set_item_string_decref(dict, "comm",
819 PyString_FromString(thread__comm_str(thread))); 817 PyString_FromString(thread__comm_str(al->thread)));
820 if (al->map) { 818 if (al->map) {
821 pydict_set_item_string_decref(dict, "dso", 819 pydict_set_item_string_decref(dict, "dso",
822 PyString_FromString(al->map->dso->name)); 820 PyString_FromString(al->map->dso->name));
@@ -843,22 +841,21 @@ exit:
843static void python_process_event(union perf_event *event, 841static void python_process_event(union perf_event *event,
844 struct perf_sample *sample, 842 struct perf_sample *sample,
845 struct perf_evsel *evsel, 843 struct perf_evsel *evsel,
846 struct thread *thread,
847 struct addr_location *al) 844 struct addr_location *al)
848{ 845{
849 struct tables *tables = &tables_global; 846 struct tables *tables = &tables_global;
850 847
851 switch (evsel->attr.type) { 848 switch (evsel->attr.type) {
852 case PERF_TYPE_TRACEPOINT: 849 case PERF_TYPE_TRACEPOINT:
853 python_process_tracepoint(sample, evsel, thread, al); 850 python_process_tracepoint(sample, evsel, al);
854 break; 851 break;
855 /* Reserve for future process_hw/sw/raw APIs */ 852 /* Reserve for future process_hw/sw/raw APIs */
856 default: 853 default:
857 if (tables->db_export_mode) 854 if (tables->db_export_mode)
858 db_export__sample(&tables->dbe, event, sample, evsel, 855 db_export__sample(&tables->dbe, event, sample, evsel,
859 thread, al); 856 al->thread, al);
860 else 857 else
861 python_process_general_event(sample, evsel, thread, al); 858 python_process_general_event(sample, evsel, al);
862 } 859 }
863} 860}
864 861
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 5c9bdd1591a9..9df61059a85d 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -43,7 +43,6 @@ static int stop_script_unsupported(void)
43static void process_event_unsupported(union perf_event *event __maybe_unused, 43static void process_event_unsupported(union perf_event *event __maybe_unused,
44 struct perf_sample *sample __maybe_unused, 44 struct perf_sample *sample __maybe_unused,
45 struct perf_evsel *evsel __maybe_unused, 45 struct perf_evsel *evsel __maybe_unused,
46 struct thread *thread __maybe_unused,
47 struct addr_location *al __maybe_unused) 46 struct addr_location *al __maybe_unused)
48{ 47{
49} 48}
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 356629a30ca9..d5168f0be4ec 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -72,8 +72,7 @@ struct scripting_ops {
72 void (*process_event) (union perf_event *event, 72 void (*process_event) (union perf_event *event,
73 struct perf_sample *sample, 73 struct perf_sample *sample,
74 struct perf_evsel *evsel, 74 struct perf_evsel *evsel,
75 struct thread *thread, 75 struct addr_location *al);
76 struct addr_location *al);
77 int (*generate_script) (struct pevent *pevent, const char *outfile); 76 int (*generate_script) (struct pevent *pevent, const char *outfile);
78}; 77};
79 78