]> Pileus Git - ~andy/linux/blob - tools/perf/util/process_event.c
perf symbols: When not using modules, discard its symbols
[~andy/linux] / tools / perf / util / process_event.c
1 #include "process_event.h"
2
3 char    *cwd;
4 int     cwdlen;
5
6 int
7 process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
8 {
9         struct map *map = map__new(&event->mmap, 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 }
33
34 int
35 process_comm_event(event_t *event, unsigned long offset, unsigned long head)
36 {
37         struct thread *thread = threads__findnew(event->comm.pid);
38
39         dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n",
40                 (void *)(offset + head),
41                 (void *)(long)(event->header.size),
42                 event->comm.comm, event->comm.pid);
43
44         if (thread == NULL ||
45             thread__set_comm_adjust(thread, event->comm.comm)) {
46                 dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
47                 return -1;
48         }
49         total_comm++;
50
51         return 0;
52 }
53