perf machine: Introduce find_thread method
Commit-ID: 9d2f8e22fc965bcdd5561d000d234fe2d23657ba Gitweb: http://git.kernel.org/tip/9d2f8e22fc965bcdd5561d000d234fe2d23657ba Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Sat, 6 Oct 2012 15:43:20 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Sat, 6 Oct 2012 16:33:22 -0300
perf machine: Introduce find_thread method
There are cases where we want just to find a thread if it exists already, so provide a method for that.
While doing that start moving 'machine' methods to a separate file.
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/Makefile | 2 + tools/perf/util/machine.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/machine.h | 11 ++++++++ tools/perf/util/thread.c | 41 +------------------------------- tools/perf/util/thread.h | 2 + 5 files changed, 73 insertions(+), 40 deletions(-)
tools/perf/Makefile +2 -0
@@ -300,6 +300,7 @@ LIB_H += util/evlist.h LIB_H += util/exec_cmd.h LIB_H += util/types.h LIB_H += util/levenshtein.h +LIB_H += util/machine.h LIB_H += util/map.h LIB_H += util/parse-options.h LIB_H += util/parse-events.h
@@ -383,6 +384,7 @@ LIB_OBJS += $(OUTPUT)util/header.o LIB_OBJS += $(OUTPUT)util/callchain.o LIB_OBJS += $(OUTPUT)util/values.o LIB_OBJS += $(OUTPUT)util/debug.o +LIB_OBJS += $(OUTPUT)util/machine.o LIB_OBJS += $(OUTPUT)util/map.o LIB_OBJS += $(OUTPUT)util/pstack.o LIB_OBJS += $(OUTPUT)util/session.o
tools/perf/util/machine.c new file +57 -0
57 lines not on this page · raw message
tools/perf/util/machine.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __PERF_MACHINE_H +#define __PERF_MACHINE_H + +#include <sys/types.h> + +struct thread ; +struct machine ; + +struct thread *machine__find_thread (struct machine *machine,pid_t pid); + +#endif /* __PERF_MACHINE_H */
tools/perf/util/thread.c +1 -40
53 lines not on this page · raw message
tools/perf/util/thread.h +2 -0
@@ -3,6 +3,7 @@#include <linux/rbtree.h> #include <unistd.h> +#include <sys/types.h> #include "symbol.h" struct thread {
@@ -22,6 +23,7 @@ struct thread {struct machine ; +struct thread *thread__new (pid_t pid);void thread__delete (struct thread *self);int thread__set_comm (struct thread *self,const char *comm);