aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/data_map.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-13 16:50:26 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-14 10:57:15 -0500
commit13df45ca1c9a430d5f53862854070fcc324e015c (patch)
treed20c0bfe5d0caedb2f2dd1f0959255127a7e9a26 /tools/perf/util/data_map.c
parent301a0b020210360c6e441c7765521248bc87d58e (diff)
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>
Diffstat (limited to 'tools/perf/util/data_map.c')
-rw-r--r--tools/perf/util/data_map.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/data_map.c b/tools/perf/util/data_map.c
index ba5bcfa1f908..36e3bfe73196 100644
--- a/tools/perf/util/data_map.c
+++ b/tools/perf/util/data_map.c
@@ -1,6 +1,7 @@
1#include "symbol.h" 1#include "symbol.h"
2#include "util.h" 2#include "util.h"
3#include "debug.h" 3#include "debug.h"
4#include "thread.h"
4#include "session.h" 5#include "session.h"
5 6
6static unsigned long mmap_window = 32; 7static unsigned long mmap_window = 32;
@@ -127,6 +128,18 @@ out:
127 return err; 128 return err;
128} 129}
129 130
131static struct thread *perf_session__register_idle_thread(struct perf_session *self __used)
132{
133 struct thread *thread = threads__findnew(0);
134
135 if (!thread || thread__set_comm(thread, "swapper")) {
136 pr_err("problem inserting idle task.\n");
137 thread = NULL;
138 }
139
140 return thread;
141}
142
130int perf_session__process_events(struct perf_session *self, 143int perf_session__process_events(struct perf_session *self,
131 struct perf_event_ops *ops, 144 struct perf_event_ops *ops,
132 int full_paths, int *cwdlen, char **cwd) 145 int full_paths, int *cwdlen, char **cwd)
@@ -140,6 +153,9 @@ int perf_session__process_events(struct perf_session *self,
140 uint32_t size; 153 uint32_t size;
141 char *buf; 154 char *buf;
142 155
156 if (perf_session__register_idle_thread(self) == NULL)
157 return -ENOMEM;
158
143 perf_event_ops__fill_defaults(ops); 159 perf_event_ops__fill_defaults(ops);
144 160
145 page_size = getpagesize(); 161 page_size = getpagesize();