Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+11 -17
+3 -3
tools/perf/builtin-script.c
··· 446 446 } 447 447 448 448 static void process_event(union perf_event *event, struct perf_sample *sample, 449 - struct perf_evsel *evsel, struct thread *thread, 450 - struct addr_location *al) 449 + struct perf_evsel *evsel, struct addr_location *al) 451 450 { 451 + struct thread *thread = al->thread; 452 452 struct perf_event_attr *attr = &evsel->attr; 453 453 454 454 if (output[attr->type].fields == 0) ··· 573 573 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) 574 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 578 return 0; 579 579 }
+2 -3
tools/perf/util/scripting-engines/trace-event-perl.c
··· 360 360 static void perl_process_event(union perf_event *event, 361 361 struct perf_sample *sample, 362 362 struct perf_evsel *evsel, 363 - struct thread *thread, 364 - struct addr_location *al __maybe_unused) 363 + struct addr_location *al) 365 364 { 366 - perl_process_tracepoint(sample, evsel, thread); 365 + perl_process_tracepoint(sample, evsel, al->thread); 367 366 perl_process_event_generic(event, sample, evsel); 368 367 } 369 368
+5 -8
tools/perf/util/scripting-engines/trace-event-python.c
··· 381 381 382 382 static void python_process_tracepoint(struct perf_sample *sample, 383 383 struct perf_evsel *evsel, 384 - struct thread *thread, 385 384 struct addr_location *al) 386 385 { 387 386 struct event_format *event = evsel->tp_format; ··· 394 395 int cpu = sample->cpu; 395 396 void *data = sample->raw_data; 396 397 unsigned long long nsecs = sample->time; 397 - const char *comm = thread__comm_str(thread); 398 + const char *comm = thread__comm_str(al->thread); 398 399 399 400 t = PyTuple_New(MAX_FIELDS); 400 401 if (!t) ··· 765 766 766 767 static void python_process_general_event(struct perf_sample *sample, 767 768 struct perf_evsel *evsel, 768 - struct thread *thread, 769 769 struct addr_location *al) 770 770 { 771 771 PyObject *handler, *t, *dict, *callchain, *dict_sample; ··· 814 816 pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( 815 817 (const char *)sample->raw_data, sample->raw_size)); 816 818 pydict_set_item_string_decref(dict, "comm", 817 - PyString_FromString(thread__comm_str(thread))); 819 + PyString_FromString(thread__comm_str(al->thread))); 818 820 if (al->map) { 819 821 pydict_set_item_string_decref(dict, "dso", 820 822 PyString_FromString(al->map->dso->name)); ··· 841 843 static void python_process_event(union perf_event *event, 842 844 struct perf_sample *sample, 843 845 struct perf_evsel *evsel, 844 - struct thread *thread, 845 846 struct addr_location *al) 846 847 { 847 848 struct tables *tables = &tables_global; 848 849 849 850 switch (evsel->attr.type) { 850 851 case PERF_TYPE_TRACEPOINT: 851 - python_process_tracepoint(sample, evsel, thread, al); 852 + python_process_tracepoint(sample, evsel, al); 852 853 break; 853 854 /* Reserve for future process_hw/sw/raw APIs */ 854 855 default: 855 856 if (tables->db_export_mode) 856 857 db_export__sample(&tables->dbe, event, sample, evsel, 857 - thread, al); 858 + al->thread, al); 858 859 else 859 - python_process_general_event(sample, evsel, thread, al); 860 + python_process_general_event(sample, evsel, al); 860 861 } 861 862 } 862 863
-1
tools/perf/util/trace-event-scripting.c
··· 43 43 static void process_event_unsupported(union perf_event *event __maybe_unused, 44 44 struct perf_sample *sample __maybe_unused, 45 45 struct perf_evsel *evsel __maybe_unused, 46 - struct thread *thread __maybe_unused, 47 46 struct addr_location *al __maybe_unused) 48 47 { 49 48 }
+1 -2
tools/perf/util/trace-event.h
··· 72 72 void (*process_event) (union perf_event *event, 73 73 struct perf_sample *sample, 74 74 struct perf_evsel *evsel, 75 - struct thread *thread, 76 - struct addr_location *al); 75 + struct addr_location *al); 77 76 int (*generate_script) (struct pevent *pevent, const char *outfile); 78 77 }; 79 78