perf session: Register the idle thread in perf_session__process_events

No need for all tools to register it and then immediately call
perf_session__process_events.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260741029-4430-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo
2009-12-13 19:50:26 -02:00
committed by Ingo Molnar
parent 301a0b0202
commit 13df45ca1c
8 changed files with 16 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
#include "symbol.h"
#include "util.h"
#include "debug.h"
#include "thread.h"
#include "session.h"
static unsigned long mmap_window = 32;
@@ -127,6 +128,18 @@ out:
return err;
}
static struct thread *perf_session__register_idle_thread(struct perf_session *self __used)
{
struct thread *thread = threads__findnew(0);
if (!thread || thread__set_comm(thread, "swapper")) {
pr_err("problem inserting idle task.\n");
thread = NULL;
}
return thread;
}
int perf_session__process_events(struct perf_session *self,
struct perf_event_ops *ops,
int full_paths, int *cwdlen, char **cwd)
@@ -140,6 +153,9 @@ int perf_session__process_events(struct perf_session *self,
uint32_t size;
char *buf;
if (perf_session__register_idle_thread(self) == NULL)
return -ENOMEM;
perf_event_ops__fill_defaults(ops);
page_size = getpagesize();