diff options
Diffstat (limited to 'tools/perf/util/data_map.c')
-rw-r--r-- | tools/perf/util/data_map.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/tools/perf/util/data_map.c b/tools/perf/util/data_map.c index b238462b8983..ca0bedf637c2 100644 --- a/tools/perf/util/data_map.c +++ b/tools/perf/util/data_map.c | |||
@@ -8,11 +8,9 @@ static struct perf_file_handler *curr_handler; | |||
8 | static unsigned long mmap_window = 32; | 8 | static unsigned long mmap_window = 32; |
9 | static char __cwd[PATH_MAX]; | 9 | static char __cwd[PATH_MAX]; |
10 | 10 | ||
11 | static int | 11 | static int process_event_stub(event_t *event __used) |
12 | process_event_stub(event_t *event __used, | ||
13 | unsigned long offset __used, | ||
14 | unsigned long head __used) | ||
15 | { | 12 | { |
13 | dump_printf(": unhandled!\n"); | ||
16 | return 0; | 14 | return 0; |
17 | } | 15 | } |
18 | 16 | ||
@@ -40,30 +38,62 @@ void register_perf_file_handler(struct perf_file_handler *handler) | |||
40 | curr_handler = handler; | 38 | curr_handler = handler; |
41 | } | 39 | } |
42 | 40 | ||
41 | static const char *event__name[] = { | ||
42 | [0] = "TOTAL", | ||
43 | [PERF_RECORD_MMAP] = "MMAP", | ||
44 | [PERF_RECORD_LOST] = "LOST", | ||
45 | [PERF_RECORD_COMM] = "COMM", | ||
46 | [PERF_RECORD_EXIT] = "EXIT", | ||
47 | [PERF_RECORD_THROTTLE] = "THROTTLE", | ||
48 | [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE", | ||
49 | [PERF_RECORD_FORK] = "FORK", | ||
50 | [PERF_RECORD_READ] = "READ", | ||
51 | [PERF_RECORD_SAMPLE] = "SAMPLE", | ||
52 | }; | ||
53 | |||
54 | unsigned long event__total[PERF_RECORD_MAX]; | ||
55 | |||
56 | void event__print_totals(void) | ||
57 | { | ||
58 | int i; | ||
59 | for (i = 0; i < PERF_RECORD_MAX; ++i) | ||
60 | pr_info("%10s events: %10ld\n", | ||
61 | event__name[i], event__total[i]); | ||
62 | } | ||
63 | |||
43 | static int | 64 | static int |
44 | process_event(event_t *event, unsigned long offset, unsigned long head) | 65 | process_event(event_t *event, unsigned long offset, unsigned long head) |
45 | { | 66 | { |
46 | trace_event(event); | 67 | trace_event(event); |
47 | 68 | ||
69 | if (event->header.type < PERF_RECORD_MAX) { | ||
70 | dump_printf("%p [%p]: PERF_RECORD_%s", | ||
71 | (void *)(offset + head), | ||
72 | (void *)(long)(event->header.size), | ||
73 | event__name[event->header.type]); | ||
74 | ++event__total[0]; | ||
75 | ++event__total[event->header.type]; | ||
76 | } | ||
77 | |||
48 | switch (event->header.type) { | 78 | switch (event->header.type) { |
49 | case PERF_RECORD_SAMPLE: | 79 | case PERF_RECORD_SAMPLE: |
50 | return curr_handler->process_sample_event(event, offset, head); | 80 | return curr_handler->process_sample_event(event); |
51 | case PERF_RECORD_MMAP: | 81 | case PERF_RECORD_MMAP: |
52 | return curr_handler->process_mmap_event(event, offset, head); | 82 | return curr_handler->process_mmap_event(event); |
53 | case PERF_RECORD_COMM: | 83 | case PERF_RECORD_COMM: |
54 | return curr_handler->process_comm_event(event, offset, head); | 84 | return curr_handler->process_comm_event(event); |
55 | case PERF_RECORD_FORK: | 85 | case PERF_RECORD_FORK: |
56 | return curr_handler->process_fork_event(event, offset, head); | 86 | return curr_handler->process_fork_event(event); |
57 | case PERF_RECORD_EXIT: | 87 | case PERF_RECORD_EXIT: |
58 | return curr_handler->process_exit_event(event, offset, head); | 88 | return curr_handler->process_exit_event(event); |
59 | case PERF_RECORD_LOST: | 89 | case PERF_RECORD_LOST: |
60 | return curr_handler->process_lost_event(event, offset, head); | 90 | return curr_handler->process_lost_event(event); |
61 | case PERF_RECORD_READ: | 91 | case PERF_RECORD_READ: |
62 | return curr_handler->process_read_event(event, offset, head); | 92 | return curr_handler->process_read_event(event); |
63 | case PERF_RECORD_THROTTLE: | 93 | case PERF_RECORD_THROTTLE: |
64 | return curr_handler->process_throttle_event(event, offset, head); | 94 | return curr_handler->process_throttle_event(event); |
65 | case PERF_RECORD_UNTHROTTLE: | 95 | case PERF_RECORD_UNTHROTTLE: |
66 | return curr_handler->process_unthrottle_event(event, offset, head); | 96 | return curr_handler->process_unthrottle_event(event); |
67 | default: | 97 | default: |
68 | curr_handler->total_unknown++; | 98 | curr_handler->total_unknown++; |
69 | return -1; | 99 | return -1; |