From 7775746dd024669cf9306c2ca9875885a41b312f Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Wed, 8 Aug 2012 17:57:52 +0800 Subject: [PATCH] --- yaml --- r: 323647 b: refs/heads/master c: 73994dc158a24df4af77d0a76c9702f120f7a6ad h: refs/heads/master i: 323645: 12261a8e70cadc25b70bb2228aade952125cf066 323643: fa456fbe8f81654e4daea191c4bb335fb561fd30 323639: e6d58596c9b2d04daedd99269a5de837e15c8ac3 323631: 2bc4828bec39f65b89e22e7a518e6ddcb0bb05fe 323615: a57913bf92efeed88760e2ff69387d758d01c5d6 323583: 375e9e592b0105b5df2a309561edfe803bd6ef7b v: v3 --- [refs] | 2 +- trunk/tools/perf/builtin-script.c | 5 +++-- .../perf/util/scripting-engines/trace-event-perl.c | 11 ++++++----- .../util/scripting-engines/trace-event-python.c | 13 +++++++------ trunk/tools/perf/util/trace-event-scripting.c | 2 +- trunk/tools/perf/util/trace-event.h | 5 +++-- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 1898f6e46f81..efe8982b3dd3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6a6daec2ae9f097703c1da4925367f1c198c9492 +refs/heads/master: 73994dc158a24df4af77d0a76c9702f120f7a6ad diff --git a/trunk/tools/perf/builtin-script.c b/trunk/tools/perf/builtin-script.c index 6425612b4d99..30a9cb8c9927 100644 --- a/trunk/tools/perf/builtin-script.c +++ b/trunk/tools/perf/builtin-script.c @@ -396,9 +396,10 @@ static void print_sample_bts(union perf_event *event, static void process_event(union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine, - struct thread *thread) + struct addr_location *al) { struct perf_event_attr *attr = &evsel->attr; + struct thread *thread = al->thread; if (output[attr->type].fields == 0) return; @@ -511,7 +512,7 @@ static int process_sample_event(struct perf_tool *tool __used, if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) return 0; - scripting_ops->process_event(event, sample, evsel, machine, thread); + scripting_ops->process_event(event, sample, evsel, machine, &al); evsel->hists.stats.total_period += sample->period; return 0; diff --git a/trunk/tools/perf/util/scripting-engines/trace-event-perl.c b/trunk/tools/perf/util/scripting-engines/trace-event-perl.c index 52580d09d75c..d28001016fb5 100644 --- a/trunk/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/trunk/tools/perf/util/scripting-engines/trace-event-perl.c @@ -261,7 +261,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine __unused, - struct thread *thread) + struct addr_location *al) { struct format_field *field; static char handler[256]; @@ -272,6 +272,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __unused, int cpu = sample->cpu; void *data = sample->raw_data; unsigned long long nsecs = sample->time; + struct thread *thread = al->thread; char *comm = thread->comm; dSP; @@ -349,7 +350,7 @@ static void perl_process_event_generic(union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine __unused, - struct thread *thread __unused) + struct addr_location *al __unused) { dSP; @@ -375,10 +376,10 @@ static void perl_process_event(union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine, - struct thread *thread) + struct addr_location *al) { - perl_process_tracepoint(event, sample, evsel, machine, thread); - perl_process_event_generic(event, sample, evsel, machine, thread); + perl_process_tracepoint(event, sample, evsel, machine, al); + perl_process_event_generic(event, sample, evsel, machine, al); } static void run_start_sub(void) diff --git a/trunk/tools/perf/util/scripting-engines/trace-event-python.c b/trunk/tools/perf/util/scripting-engines/trace-event-python.c index b9010d878b4b..24711b3536d3 100644 --- a/trunk/tools/perf/util/scripting-engines/trace-event-python.c +++ b/trunk/tools/perf/util/scripting-engines/trace-event-python.c @@ -225,7 +225,7 @@ static void python_process_tracepoint(union perf_event *perf_event __unused, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine __unused, - struct thread *thread) + struct addr_location *al) { PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; static char handler_name[256]; @@ -238,6 +238,7 @@ static void python_process_tracepoint(union perf_event *perf_event __unused, int cpu = sample->cpu; void *data = sample->raw_data; unsigned long long nsecs = sample->time; + struct thread *thread = al->thread; char *comm = thread->comm; t = PyTuple_New(MAX_FIELDS); @@ -342,7 +343,7 @@ static void python_process_general_event(union perf_event *perf_event __unused, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine __unused, - struct thread *thread __unused) + struct addr_location *al __unused) { PyObject *handler, *retval, *t; static char handler_name[64]; @@ -361,7 +362,7 @@ static void python_process_general_event(union perf_event *perf_event __unused, goto exit; } - /* Pass 3 parameters: event_attr, perf_sample, raw data */ + /* Pass 4 parameters: event_attr, perf_sample, raw data, thread name */ PyTuple_SetItem(t, n++, PyString_FromStringAndSize((void *)&evsel->attr, sizeof(evsel->attr))); PyTuple_SetItem(t, n++, PyString_FromStringAndSize((void *)sample, sizeof(*sample))); PyTuple_SetItem(t, n++, PyString_FromStringAndSize(data, sample->raw_size)); @@ -380,17 +381,17 @@ static void python_process_event(union perf_event *perf_event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine, - struct thread *thread) + struct addr_location *al) { switch (evsel->attr.type) { case PERF_TYPE_TRACEPOINT: python_process_tracepoint(perf_event, sample, evsel, - machine, thread); + machine, al); break; /* Reserve for future process_hw/sw/raw APIs */ default: python_process_general_event(perf_event, sample, evsel, - machine, thread); + machine, al); } } diff --git a/trunk/tools/perf/util/trace-event-scripting.c b/trunk/tools/perf/util/trace-event-scripting.c index aceb8eea15fc..302ff262494c 100644 --- a/trunk/tools/perf/util/trace-event-scripting.c +++ b/trunk/tools/perf/util/trace-event-scripting.c @@ -39,7 +39,7 @@ static void process_event_unsupported(union perf_event *event __unused, struct perf_sample *sample __unused, struct perf_evsel *evsel __unused, struct machine *machine __unused, - struct thread *thread __unused) + struct addr_location *al __unused) { } diff --git a/trunk/tools/perf/util/trace-event.h b/trunk/tools/perf/util/trace-event.h index cee16350cd86..7575dfd26e58 100644 --- a/trunk/tools/perf/util/trace-event.h +++ b/trunk/tools/perf/util/trace-event.h @@ -9,7 +9,6 @@ struct machine; struct perf_sample; union perf_event; struct perf_tool; -struct thread; extern int header_page_size_size; extern int header_page_ts_size; @@ -76,6 +75,8 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, void tracing_data_put(struct tracing_data *tdata); +struct addr_location; + struct scripting_ops { const char *name; int (*start_script) (const char *script, int argc, const char **argv); @@ -84,7 +85,7 @@ struct scripting_ops { struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine, - struct thread *thread); + struct addr_location *al); int (*generate_script) (struct pevent *pevent, const char *outfile); };