aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-05-11 20:56:42 -0400
committerJiri Olsa <jolsa@kernel.org>2014-05-12 05:09:50 -0400
commit13ce34df11833482cd698331fdbb3f8ced06340d (patch)
tree9831bc0915afd571535d6649497cb4a5f62f3411 /tools
parentbac1e4d103f7e3d82e5dc7423c04edcb8c899c22 (diff)
perf tools: Use tid for finding thread
I believe that passing pid (instead of tid) as the 3rd arg of the machine__find*_thread() was to find a main thread so that it can search proper map group for symbols. However with the map sharing patch applied, it now can do it in any thread. It fixes a bug when each thread has different name, it only reports a main thread for samples in other threads. Cc: Adrian Hunter <adrian.hunter@intel.com> Acked-by: David Ahern <dsahern@gmail.com> Acked-by: Stephane Eranian <eranian@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1399856202-26221-1-git-send-email-namhyung@kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-inject.c2
-rw-r--r--tools/perf/builtin-kmem.c2
-rw-r--r--tools/perf/tests/code-reading.c2
-rw-r--r--tools/perf/tests/hists_filter.c1
-rw-r--r--tools/perf/tests/hists_link.c2
-rw-r--r--tools/perf/util/build-id.c2
-rw-r--r--tools/perf/util/event.c2
7 files changed, 8 insertions, 5 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 3a7387551369..6a3af0013d68 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -209,7 +209,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
209 209
210 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 210 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
211 211
212 thread = machine__findnew_thread(machine, sample->pid, sample->pid); 212 thread = machine__findnew_thread(machine, sample->pid, sample->tid);
213 if (thread == NULL) { 213 if (thread == NULL) {
214 pr_err("problem processing %d event, skipping it.\n", 214 pr_err("problem processing %d event, skipping it.\n",
215 event->header.type); 215 event->header.type);
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index f91fa4376f4b..bef3376bfaf3 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -235,7 +235,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
235 struct machine *machine) 235 struct machine *machine)
236{ 236{
237 struct thread *thread = machine__findnew_thread(machine, sample->pid, 237 struct thread *thread = machine__findnew_thread(machine, sample->pid,
238 sample->pid); 238 sample->tid);
239 239
240 if (thread == NULL) { 240 if (thread == NULL) {
241 pr_debug("problem processing %d event, skipping it.\n", 241 pr_debug("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index adf3de3e38d6..67f2d6323558 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -256,7 +256,7 @@ static int process_sample_event(struct machine *machine,
256 return -1; 256 return -1;
257 } 257 }
258 258
259 thread = machine__findnew_thread(machine, sample.pid, sample.pid); 259 thread = machine__findnew_thread(machine, sample.pid, sample.tid);
260 if (!thread) { 260 if (!thread) {
261 pr_debug("machine__findnew_thread failed\n"); 261 pr_debug("machine__findnew_thread failed\n");
262 return -1; 262 return -1;
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 23dc2f4d12c3..4617a8bee29b 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -69,6 +69,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
69 evsel->hists.symbol_filter_str = NULL; 69 evsel->hists.symbol_filter_str = NULL;
70 70
71 sample.pid = fake_samples[i].pid; 71 sample.pid = fake_samples[i].pid;
72 sample.tid = fake_samples[i].pid;
72 sample.ip = fake_samples[i].ip; 73 sample.ip = fake_samples[i].ip;
73 74
74 if (perf_event__preprocess_sample(&event, machine, &al, 75 if (perf_event__preprocess_sample(&event, machine, &al,
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index e42d6790811a..b009bbf440d9 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -81,6 +81,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
81 }; 81 };
82 82
83 sample.pid = fake_common_samples[k].pid; 83 sample.pid = fake_common_samples[k].pid;
84 sample.tid = fake_common_samples[k].pid;
84 sample.ip = fake_common_samples[k].ip; 85 sample.ip = fake_common_samples[k].ip;
85 if (perf_event__preprocess_sample(&event, machine, &al, 86 if (perf_event__preprocess_sample(&event, machine, &al,
86 &sample) < 0) 87 &sample) < 0)
@@ -104,6 +105,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
104 }; 105 };
105 106
106 sample.pid = fake_samples[i][k].pid; 107 sample.pid = fake_samples[i][k].pid;
108 sample.tid = fake_samples[i][k].pid;
107 sample.ip = fake_samples[i][k].ip; 109 sample.ip = fake_samples[i][k].ip;
108 if (perf_event__preprocess_sample(&event, machine, &al, 110 if (perf_event__preprocess_sample(&event, machine, &al,
109 &sample) < 0) 111 &sample) < 0)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 6baabe63182b..a904a4cfe7d3 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -25,7 +25,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
25 struct addr_location al; 25 struct addr_location al;
26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
27 struct thread *thread = machine__findnew_thread(machine, sample->pid, 27 struct thread *thread = machine__findnew_thread(machine, sample->pid,
28 sample->pid); 28 sample->tid);
29 29
30 if (thread == NULL) { 30 if (thread == NULL) {
31 pr_err("problem processing %d event, skipping it.\n", 31 pr_err("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index dbcaea1a8180..65795b835b39 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -788,7 +788,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
788{ 788{
789 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 789 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
790 struct thread *thread = machine__findnew_thread(machine, sample->pid, 790 struct thread *thread = machine__findnew_thread(machine, sample->pid,
791 sample->pid); 791 sample->tid);
792 792
793 if (thread == NULL) 793 if (thread == NULL)
794 return -1; 794 return -1;