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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
711460514b
commit
480ca357fd
@@ -265,3 +265,14 @@ void thread__find_cpumode_addr_location(struct thread *thread,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct thread *thread__main_thread(struct machine *machine, struct thread *thread)
|
||||
{
|
||||
if (thread->pid_ == thread->tid)
|
||||
return thread__get(thread);
|
||||
|
||||
if (thread->pid_ == -1)
|
||||
return NULL;
|
||||
|
||||
return machine__find_thread(machine, thread->pid_, thread->pid_);
|
||||
}
|
||||
|
Reference in New Issue
Block a user