diff options
author | Andi Kleen <ak@linux.intel.com> | 2016-05-23 20:52:24 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-05-30 11:41:43 -0400 |
commit | 480ca357fd7f86a381a5b35a8157aa176eddbed4 (patch) | |
tree | bd17401551a8cec3f0ebd7a496b298742865492b /tools/perf/util/thread.c | |
parent | 711460514b1c80494f14001bdf30dd70fd401a8f (diff) |
perf thread: Adopt get_main_thread from db-export.c
Move the get_main_thread function from db-export.c to thread.c so that
it can be used elsewhere.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1464051145-19968-2-git-send-email-andi@firstfloor.org
[ Removed leftover bits from db-export.h ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r-- | tools/perf/util/thread.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 45fcb715a36b..ada58e6070bf 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -265,3 +265,14 @@ void thread__find_cpumode_addr_location(struct thread *thread, | |||
265 | break; | 265 | break; |
266 | } | 266 | } |
267 | } | 267 | } |
268 | |||
269 | struct thread *thread__main_thread(struct machine *machine, struct thread *thread) | ||
270 | { | ||
271 | if (thread->pid_ == thread->tid) | ||
272 | return thread__get(thread); | ||
273 | |||
274 | if (thread->pid_ == -1) | ||
275 | return NULL; | ||
276 | |||
277 | return machine__find_thread(machine, thread->pid_, thread->pid_); | ||
278 | } | ||