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: default avatarJiri Olsa <jolsa@redhat.com>
Acked-by: default avatarNamhyung 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 79628f2c
...@@ -446,9 +446,9 @@ static void print_sample_bts(union perf_event *event, ...@@ -446,9 +446,9 @@ static void print_sample_bts(union perf_event *event,
} }
static void process_event(union perf_event *event, struct perf_sample *sample, static void process_event(union perf_event *event, struct perf_sample *sample,
struct perf_evsel *evsel, struct thread *thread, struct perf_evsel *evsel, struct addr_location *al)
struct addr_location *al)
{ {
struct thread *thread = al->thread;
struct perf_event_attr *attr = &evsel->attr; struct perf_event_attr *attr = &evsel->attr;
if (output[attr->type].fields == 0) if (output[attr->type].fields == 0)
...@@ -573,7 +573,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, ...@@ -573,7 +573,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
return 0; return 0;
scripting_ops->process_event(event, sample, evsel, al.thread, &al); scripting_ops->process_event(event, sample, evsel, &al);
return 0; return 0;
} }
......
...@@ -360,10 +360,9 @@ static void perl_process_event_generic(union perf_event *event, ...@@ -360,10 +360,9 @@ static void perl_process_event_generic(union perf_event *event,
static void perl_process_event(union perf_event *event, static void perl_process_event(union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct thread *thread, struct addr_location *al)
struct addr_location *al __maybe_unused)
{ {
perl_process_tracepoint(sample, evsel, thread); perl_process_tracepoint(sample, evsel, al->thread);
perl_process_event_generic(event, sample, evsel); perl_process_event_generic(event, sample, evsel);
} }
......
...@@ -381,7 +381,6 @@ static PyObject *python_process_callchain(struct perf_sample *sample, ...@@ -381,7 +381,6 @@ static PyObject *python_process_callchain(struct perf_sample *sample,
static void python_process_tracepoint(struct perf_sample *sample, static void python_process_tracepoint(struct perf_sample *sample,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct thread *thread,
struct addr_location *al) struct addr_location *al)
{ {
struct event_format *event = evsel->tp_format; struct event_format *event = evsel->tp_format;
...@@ -395,7 +394,7 @@ static void python_process_tracepoint(struct perf_sample *sample, ...@@ -395,7 +394,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
int cpu = sample->cpu; int cpu = sample->cpu;
void *data = sample->raw_data; void *data = sample->raw_data;
unsigned long long nsecs = sample->time; unsigned long long nsecs = sample->time;
const char *comm = thread__comm_str(thread); const char *comm = thread__comm_str(al->thread);
t = PyTuple_New(MAX_FIELDS); t = PyTuple_New(MAX_FIELDS);
if (!t) if (!t)
...@@ -766,7 +765,6 @@ static int python_process_call_return(struct call_return *cr, void *data) ...@@ -766,7 +765,6 @@ static int python_process_call_return(struct call_return *cr, void *data)
static void python_process_general_event(struct perf_sample *sample, static void python_process_general_event(struct perf_sample *sample,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct thread *thread,
struct addr_location *al) struct addr_location *al)
{ {
PyObject *handler, *t, *dict, *callchain, *dict_sample; PyObject *handler, *t, *dict, *callchain, *dict_sample;
...@@ -816,7 +814,7 @@ static void python_process_general_event(struct perf_sample *sample, ...@@ -816,7 +814,7 @@ static void python_process_general_event(struct perf_sample *sample,
pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
(const char *)sample->raw_data, sample->raw_size)); (const char *)sample->raw_data, sample->raw_size));
pydict_set_item_string_decref(dict, "comm", pydict_set_item_string_decref(dict, "comm",
PyString_FromString(thread__comm_str(thread))); PyString_FromString(thread__comm_str(al->thread)));
if (al->map) { if (al->map) {
pydict_set_item_string_decref(dict, "dso", pydict_set_item_string_decref(dict, "dso",
PyString_FromString(al->map->dso->name)); PyString_FromString(al->map->dso->name));
...@@ -843,22 +841,21 @@ static void python_process_general_event(struct perf_sample *sample, ...@@ -843,22 +841,21 @@ static void python_process_general_event(struct perf_sample *sample,
static void python_process_event(union perf_event *event, static void python_process_event(union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct thread *thread,
struct addr_location *al) struct addr_location *al)
{ {
struct tables *tables = &tables_global; struct tables *tables = &tables_global;
switch (evsel->attr.type) { switch (evsel->attr.type) {
case PERF_TYPE_TRACEPOINT: case PERF_TYPE_TRACEPOINT:
python_process_tracepoint(sample, evsel, thread, al); python_process_tracepoint(sample, evsel, al);
break; break;
/* Reserve for future process_hw/sw/raw APIs */ /* Reserve for future process_hw/sw/raw APIs */
default: default:
if (tables->db_export_mode) if (tables->db_export_mode)
db_export__sample(&tables->dbe, event, sample, evsel, db_export__sample(&tables->dbe, event, sample, evsel,
thread, al); al->thread, al);
else else
python_process_general_event(sample, evsel, thread, al); python_process_general_event(sample, evsel, al);
} }
} }
......
...@@ -43,7 +43,6 @@ static int stop_script_unsupported(void) ...@@ -43,7 +43,6 @@ static int stop_script_unsupported(void)
static void process_event_unsupported(union perf_event *event __maybe_unused, static void process_event_unsupported(union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused, struct perf_sample *sample __maybe_unused,
struct perf_evsel *evsel __maybe_unused, struct perf_evsel *evsel __maybe_unused,
struct thread *thread __maybe_unused,
struct addr_location *al __maybe_unused) struct addr_location *al __maybe_unused)
{ {
} }
......
...@@ -72,8 +72,7 @@ struct scripting_ops { ...@@ -72,8 +72,7 @@ struct scripting_ops {
void (*process_event) (union perf_event *event, void (*process_event) (union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct thread *thread, struct addr_location *al);
struct addr_location *al);
int (*generate_script) (struct pevent *pevent, const char *outfile); int (*generate_script) (struct pevent *pevent, const char *outfile);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment