Skip to contentSkip to conversation

perf threads: Move thread_map to separate file

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jan 26, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  fd78260b5376173faeb17127bd63b3c99a8e8bfb
Gitweb:     http://git.kernel.org/tip/fd78260b5376173faeb17127bd63b3c99a8e8bfb
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 18 Jan 2011 15:15:24 -0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 24 Jan 2011 10:59:00 -0200

perf threads: Move thread_map to separate file

To untangle it from struct thread handling, that is tied to symbols, etc.

Right now in the python bindings I'm working on I need just a subset of the util/ files, untangling it allows me to do that.

Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Tom Zanussi <[email protected]>
LKML-Reference: <new-submission>

---
 tools/perf/Makefile          |    2 +
 tools/perf/builtin-record.c  |    1 +
 tools/perf/builtin-stat.c    |    1 +
 tools/perf/builtin-test.c    |    2 +-
 tools/perf/builtin-top.c     |    1 +
 tools/perf/util/evsel.c      |    2 +-
 tools/perf/util/thread.c     |   55 ------------------------------------
 tools/perf/util/thread.h     |   14 ---------
 tools/perf/util/thread_map.c |   64 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/thread_map.h |   15 ++++++++++
 10 files changed, 86 insertions(+), 71 deletions(-)
tools/perf/Makefile +2 -0
index f20bc6f..638e8e1 100644
@@ -426,6 +426,7 @@ LIB_H += util/values.h
 LIB_H += util/sort.h
 LIB_H += util/hist.h
 LIB_H += util/thread.h
+LIB_H += util/thread_map.h
 LIB_H += util/trace-event.h
 LIB_H += util/probe-finder.h
 LIB_H += util/probe-event.h
@@ -471,6 +472,7 @@ LIB_OBJS += $(OUTPUT)util/map.o
 LIB_OBJS += $(OUTPUT)util/pstack.o
 LIB_OBJS += $(OUTPUT)util/session.o
 LIB_OBJS += $(OUTPUT)util/thread.o
+LIB_OBJS += $(OUTPUT)util/thread_map.o
 LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
 LIB_OBJS += $(OUTPUT)util/trace-event-read.o
 LIB_OBJS += $(OUTPUT)util/trace-event-info.o
tools/perf/builtin-record.c +1 -0
index 1346d42..d788630 100644
@@ -24,6 +24,7 @@
 #include "util/session.h"
 #include "util/symbol.h"
 #include "util/cpumap.h"
+#include "util/thread_map.h"
 
 #include <unistd.h>
 #include <sched.h>
tools/perf/builtin-stat.c +1 -0
index e2a2d02..8906adf 100644
@@ -49,6 +49,7 @@
 #include "util/header.h"
 #include "util/cpumap.h"
 #include "util/thread.h"
+#include "util/thread_map.h"
 
 #include <sys/prctl.h>
 #include <math.h>
tools/perf/builtin-test.c +1 -1
index 4fd3453..dc91ee0 100644
@@ -12,7 +12,7 @@
 #include "util/parse-events.h"
 #include "util/session.h"
 #include "util/symbol.h"
-#include "util/thread.h"
+#include "util/thread_map.h"
 
 static long page_size;
 
tools/perf/builtin-top.c +1 -0
index 31fbaf3..d0b16d9 100644
@@ -26,6 +26,7 @@
 #include "util/session.h"
 #include "util/symbol.h"
 #include "util/thread.h"
+#include "util/thread_map.h"
 #include "util/util.h"
 #include <linux/rbtree.h>
 #include "util/parse-options.h"
tools/perf/util/evsel.c +1 -1
index ee49035..9a6d942 100644
@@ -3,7 +3,7 @@
 #include "../perf.h"
 #include "util.h"
 #include "cpumap.h"
-#include "thread.h"
+#include "thread_map.h"
 
 #include <unistd.h>
 #include <sys/mman.h>
tools/perf/util/thread.c +0 -55

61 lines not on this page · raw message

tools/perf/util/thread.h +0 -14
index d757410..e5f2401 100644
@@ -18,24 +18,10 @@ struct thread {
 	int			comm_len;
 };
 
-struct thread_map {
-	int nr;
-	int map[];
-};
-
 struct perf_session;
 
 void thread__delete(struct thread *self);
 
-struct thread_map *thread_map__new_by_pid(pid_t pid);
-struct thread_map *thread_map__new_by_tid(pid_t tid);
-struct thread_map *thread_map__new(pid_t pid, pid_t tid);
-
-static inline void thread_map__delete(struct thread_map *threads)
-{
-	free(threads);
-}
-
 int thread__set_comm(struct thread *self, const char *comm);
 int thread__comm_len(struct thread *self);
 struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
tools/perf/util/thread_map.c new file +64 -0

64 lines not on this page · raw message

tools/perf/util/thread_map.h new file +15 -0
new file mode 100644
index 0000000..3cb9073
@@ -0,0 +1,15 @@
+#ifndef __PERF_THREAD_MAP_H
+#define __PERF_THREAD_MAP_H
+
+#include <sys/types.h>
+
+struct thread_map {
+	int nr;
+	int map[];
+};
+
+struct thread_map *thread_map__new_by_pid(pid_t pid);
+struct thread_map *thread_map__new_by_tid(pid_t tid);
+struct thread_map *thread_map__new(pid_t pid, pid_t tid);
+void thread_map__delete(struct thread_map *threads);
+#endif	/* __PERF_THREAD_MAP_H */