diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-31 00:45:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-31 04:04:48 -0400 |
commit | 5b447a6a13ea823b698bf4c01193654fd7ebf4ec (patch) | |
tree | 7d3e1c20cf2fe4dbeb1a64910ace3e222bc6ad6a /tools/perf/util | |
parent | ec7ba4ea1d605029fb09601ab4ad3053bc1f519c (diff) |
perf tools: Librarize idle thread registration
Librarize register_idle_thread() used by annotate and report.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1251693921-6579-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/thread.c | 13 | ||||
-rw-r--r-- | tools/perf/util/thread.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index f98032c135c6..3acd37f54888 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -80,6 +80,19 @@ threads__findnew(pid_t pid, struct rb_root *threads, struct thread **last_match) | |||
80 | return th; | 80 | return th; |
81 | } | 81 | } |
82 | 82 | ||
83 | struct thread * | ||
84 | register_idle_thread(struct rb_root *threads, struct thread **last_match) | ||
85 | { | ||
86 | struct thread *thread = threads__findnew(0, threads, last_match); | ||
87 | |||
88 | if (!thread || thread__set_comm(thread, "[idle]")) { | ||
89 | fprintf(stderr, "problem inserting idle task.\n"); | ||
90 | exit(-1); | ||
91 | } | ||
92 | |||
93 | return thread; | ||
94 | } | ||
95 | |||
83 | void thread__insert_map(struct thread *self, struct map *map) | 96 | void thread__insert_map(struct thread *self, struct map *map) |
84 | { | 97 | { |
85 | struct map *pos, *tmp; | 98 | struct map *pos, *tmp; |
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index b1c66719379b..634f2809a342 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h | |||
@@ -13,6 +13,8 @@ struct thread { | |||
13 | int thread__set_comm(struct thread *self, const char *comm); | 13 | int thread__set_comm(struct thread *self, const char *comm); |
14 | struct thread * | 14 | struct thread * |
15 | threads__findnew(pid_t pid, struct rb_root *threads, struct thread **last_match); | 15 | threads__findnew(pid_t pid, struct rb_root *threads, struct thread **last_match); |
16 | struct thread * | ||
17 | register_idle_thread(struct rb_root *threads, struct thread **last_match); | ||
16 | void thread__insert_map(struct thread *self, struct map *map); | 18 | void thread__insert_map(struct thread *self, struct map *map); |
17 | int thread__fork(struct thread *self, struct thread *parent); | 19 | int thread__fork(struct thread *self, struct thread *parent); |
18 | struct map *thread__find_map(struct thread *self, u64 ip); | 20 | struct map *thread__find_map(struct thread *self, u64 ip); |