perf script: No need to lookup thread twice
authorArnaldo Carvalho de Melo <[email protected]>
Wed, 1 Apr 2015 16:26:45 +0000 (13:26 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Thu, 2 Apr 2015 16:18:21 +0000 (13:18 -0300)
We get the thread when we call perf_event__preprocess_sample(), no need
to do it before that.

Acked-by: Jiri Olsa <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-script.c

index 662366ceb572db57a453b9be2aaf9ca87690b0ee..c286b49c81b2ef7a4f3f4958bde24ffe616eaee8 100644 (file)
@@ -549,14 +549,6 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
                                struct machine *machine)
 {
        struct addr_location al;
-       struct thread *thread = machine__findnew_thread(machine, sample->pid,
-                                                       sample->tid);
-
-       if (thread == NULL) {
-               pr_debug("problem processing %d event, skipping it.\n",
-                        event->header.type);
-               return -1;
-       }
 
        if (debug_mode) {
                if (sample->time < last_timestamp) {
@@ -581,7 +573,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
        if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
                return 0;
 
-       scripting_ops->process_event(event, sample, evsel, thread, &al);
+       scripting_ops->process_event(event, sample, evsel, al.thread, &al);
 
        return 0;
 }