From 5b447a6a13ea823b698bf4c01193654fd7ebf4ec Mon Sep 17 00:00:00 2001 From: Frederic Weisbecker Date: Mon, 31 Aug 2009 06:45:18 +0200 Subject: perf tools: Librarize idle thread registration Librarize register_idle_thread() used by annotate and report. Signed-off-by: Frederic Weisbecker Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo LKML-Reference: <1251693921-6579-1-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar --- tools/perf/util/thread.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/perf/util/thread.c') diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index f98032c135c..3acd37f5488 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) return th; } +struct thread * +register_idle_thread(struct rb_root *threads, struct thread **last_match) +{ + struct thread *thread = threads__findnew(0, threads, last_match); + + if (!thread || thread__set_comm(thread, "[idle]")) { + fprintf(stderr, "problem inserting idle task.\n"); + exit(-1); + } + + return thread; +} + void thread__insert_map(struct thread *self, struct map *map) { struct map *pos, *tmp; -- cgit v1.2.3