aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/process_events.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-27 13:29:22 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-27 14:22:01 -0500
commit62daacb51a2bf8480e6f6b3696b03f102fc15eb0 (patch)
tree5b9ed87005a5e59bcc95dd9a42e3d09d6481362d /tools/perf/util/process_events.c
parent1de8e24520ffdcf2a90c842eed937f59079a2abd (diff)
perf tools: Reorganize event processing routines, lotsa dups killed
While implementing event__preprocess_sample, that will do all of the symbol lookup in one convenient function, I noticed that util/process_event.[ch] were not being used at all, then started looking if there were other functions that could be shared and... All those functions really don't need to receive offset + head, the only thing they did was common to all of them, so do it at one place instead. Stats about number of each type of event processed now is done in a central place. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: John Kacur <jkacur@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1259346563-12568-11-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/process_events.c')
-rw-r--r--tools/perf/util/process_events.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/tools/perf/util/process_events.c b/tools/perf/util/process_events.c
deleted file mode 100644
index 53778684641c..000000000000
--- a/tools/perf/util/process_events.c
+++ /dev/null
@@ -1,64 +0,0 @@
1#include "process_events.h"
2
3char *cwd;
4int cwdlen;
5
6int
7process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
8{
9 struct map *map = map__new(&event->mmap, MAP__FUNCTION, cwd, cwdlen);
10 struct thread *thread = threads__findnew(event->mmap.pid);
11
12 dump_printf("%p [%p]: PERF_RECORD_MMAP %d/%d: [%p(%p) @ %p]: %s\n",
13 (void *)(offset + head),
14 (void *)(long)(event->header.size),
15 event->mmap.pid,
16 event->mmap.tid,
17 (void *)(long)event->mmap.start,
18 (void *)(long)event->mmap.len,
19 (void *)(long)event->mmap.pgoff,
20 event->mmap.filename);
21
22 if (thread == NULL || map == NULL) {
23 dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
24 return 0;
25 }
26
27 thread__insert_map(thread, map);
28 total_mmap++;
29
30 return 0;
31}
32
33int
34process_task_event(event_t *event, unsigned long offset, unsigned long head)
35{
36 struct thread *thread = threads__findnew(event->fork.pid);
37 struct thread *parent = threads__findnew(event->fork.ppid);
38
39 dump_printf("%p [%p]: PERF_RECORD_%s: (%d:%d):(%d:%d)\n",
40 (void *)(offset + head),
41 (void *)(long)(event->header.size),
42 event->header.type == PERF_RECORD_FORK ? "FORK" : "EXIT",
43 event->fork.pid, event->fork.tid,
44 event->fork.ppid, event->fork.ptid);
45
46 /*
47 * A thread clone will have the same PID for both
48 * parent and child.
49 */
50 if (thread == parent)
51 return 0;
52
53 if (event->header.type == PERF_RECORD_EXIT)
54 return 0;
55
56 if (!thread || !parent || thread__fork(thread, parent)) {
57 dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
58 return -1;
59 }
60 total_fork++;
61
62 return 0;
63}
64