summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/data_map.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-27 16:29:22 -0200
committerIngo Molnar <mingo@elte.hu>2009-11-27 20:22:01 +0100
commit62daacb51a2bf8480e6f6b3696b03f102fc15eb0 (patch)
tree5b9ed87005a5e59bcc95dd9a42e3d09d6481362d /tools/perf/util/data_map.c
parent1de8e24520ffdcf2a90c842eed937f59079a2abd (diff)
downloadblackbird-op-linux-62daacb51a2bf8480e6f6b3696b03f102fc15eb0.tar.gz
blackbird-op-linux-62daacb51a2bf8480e6f6b3696b03f102fc15eb0.zip
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/data_map.c')
-rw-r--r--tools/perf/util/data_map.c56
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;
static unsigned long mmap_window = 32;
static char __cwd[PATH_MAX];
-static int
-process_event_stub(event_t *event __used,
- unsigned long offset __used,
- unsigned long head __used)
+static int process_event_stub(event_t *event __used)
{
+ dump_printf(": unhandled!\n");
return 0;
}
@@ -40,30 +38,62 @@ void register_perf_file_handler(struct perf_file_handler *handler)
curr_handler = handler;
}
+static const char *event__name[] = {
+ [0] = "TOTAL",
+ [PERF_RECORD_MMAP] = "MMAP",
+ [PERF_RECORD_LOST] = "LOST",
+ [PERF_RECORD_COMM] = "COMM",
+ [PERF_RECORD_EXIT] = "EXIT",
+ [PERF_RECORD_THROTTLE] = "THROTTLE",
+ [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
+ [PERF_RECORD_FORK] = "FORK",
+ [PERF_RECORD_READ] = "READ",
+ [PERF_RECORD_SAMPLE] = "SAMPLE",
+};
+
+unsigned long event__total[PERF_RECORD_MAX];
+
+void event__print_totals(void)
+{
+ int i;
+ for (i = 0; i < PERF_RECORD_MAX; ++i)
+ pr_info("%10s events: %10ld\n",
+ event__name[i], event__total[i]);
+}
+
static int
process_event(event_t *event, unsigned long offset, unsigned long head)
{
trace_event(event);
+ if (event->header.type < PERF_RECORD_MAX) {
+ dump_printf("%p [%p]: PERF_RECORD_%s",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ event__name[event->header.type]);
+ ++event__total[0];
+ ++event__total[event->header.type];
+ }
+
switch (event->header.type) {
case PERF_RECORD_SAMPLE:
- return curr_handler->process_sample_event(event, offset, head);
+ return curr_handler->process_sample_event(event);
case PERF_RECORD_MMAP:
- return curr_handler->process_mmap_event(event, offset, head);
+ return curr_handler->process_mmap_event(event);
case PERF_RECORD_COMM:
- return curr_handler->process_comm_event(event, offset, head);
+ return curr_handler->process_comm_event(event);
case PERF_RECORD_FORK:
- return curr_handler->process_fork_event(event, offset, head);
+ return curr_handler->process_fork_event(event);
case PERF_RECORD_EXIT:
- return curr_handler->process_exit_event(event, offset, head);
+ return curr_handler->process_exit_event(event);
case PERF_RECORD_LOST:
- return curr_handler->process_lost_event(event, offset, head);
+ return curr_handler->process_lost_event(event);
case PERF_RECORD_READ:
- return curr_handler->process_read_event(event, offset, head);
+ return curr_handler->process_read_event(event);
case PERF_RECORD_THROTTLE:
- return curr_handler->process_throttle_event(event, offset, head);
+ return curr_handler->process_throttle_event(event);
case PERF_RECORD_UNTHROTTLE:
- return curr_handler->process_unthrottle_event(event, offset, head);
+ return curr_handler->process_unthrottle_event(event);
default:
curr_handler->total_unknown++;
return -1;
OpenPOWER on IntegriCloud