Re: [PATCH v2 2/3] perf script: Replace "struct thread" with "structaddr_location" as a parameter for "process_event()"

From: Arnaldo Carvalho de Melo
Date: Thu May 31 2012 - 10:51:02 EST


Em Thu, May 31, 2012 at 02:34:31PM +0800, Feng Tang escreveu:
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 8e395a5..282e206 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -405,9 +405,10 @@ static void process_event(union perf_event *event __unused,
> struct perf_sample *sample,
> struct perf_evsel *evsel,
> struct machine *machine,
> - struct thread *thread)
> + struct addr_location *al __unused)

Why the __unused modifier, since you...

> {
> struct perf_event_attr *attr = &evsel->attr;
> + struct thread *thread = al->thread;

... are using al?

> if (output[attr->type].fields == 0)
> return;
> @@ -520,7 +521,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/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
> index 4c1b3d7..af9a6a4 100644
> --- a/tools/perf/util/scripting-engines/trace-event-perl.c
> +++ b/tools/perf/util/scripting-engines/trace-event-perl.c
> @@ -256,7 +256,7 @@ static void perl_process_tracepoint(union perf_event *pevent __unused,
> struct perf_sample *sample,
> struct perf_evsel *evsel,
> struct machine *machine __unused,
> - struct thread *thread)
> + struct addr_location *al __unused)

Ditto

> {
> struct format_field *field;
> static char handler[256];
> @@ -268,6 +268,7 @@ static void perl_process_tracepoint(union perf_event *pevent __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;
> @@ -346,7 +347,7 @@ static void perl_process_event_generic(union perf_event *pevent __unused,
> struct perf_sample *sample,
> struct perf_evsel *evsel __unused,
> struct machine *machine __unused,
> - struct thread *thread __unused)
> + struct addr_location *al __unused)

Here it seems ok

> {
> dSP;
>
> @@ -372,10 +373,10 @@ static void perl_process_event(union perf_event *pevent,
> struct perf_sample *sample,
> struct perf_evsel *evsel,
> struct machine *machine,
> - struct thread *thread)
> + struct addr_location *al)

And here it is correctly without the __unused marker

Check the others please
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/