aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-08-06 13:40:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-09 06:54:35 -0400
commit8f18aec535b5ca513dd13b531730177d35175ffa (patch)
tree6e1894685c1540c4b3f1c7dcef0315729ef3e9f1 /tools/perf/builtin-report.c
parent1c222bce7dd0cb9578b4c5cd3874a74f1db497c3 (diff)
perf report: Fix per task mult-counter stat reporting
Brice Goglin reported: > I can easily sort them by thread id, but I don't know how to match > my 4 events with each group of 4 lines. Also report the counter id and the time running/enabled stats (in case the counter got time-shared). Reported-by: Brice Goglin <Brice.Goglin@inria.fr> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Tested-by: Brice Goglin <Brice.Goglin@inria.fr> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index da402e186561..84205462e07b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -112,7 +112,9 @@ struct read_event {
112 struct perf_event_header header; 112 struct perf_event_header header;
113 u32 pid,tid; 113 u32 pid,tid;
114 u64 value; 114 u64 value;
115 u64 format[3]; 115 u64 time_enabled;
116 u64 time_running;
117 u64 id;
116}; 118};
117 119
118typedef union event_union { 120typedef union event_union {
@@ -1690,14 +1692,37 @@ static void trace_event(event_t *event)
1690 dprintf(".\n"); 1692 dprintf(".\n");
1691} 1693}
1692 1694
1695static struct perf_header *header;
1696
1697static struct perf_counter_attr *perf_header__find_attr(u64 id)
1698{
1699 int i;
1700
1701 for (i = 0; i < header->attrs; i++) {
1702 struct perf_header_attr *attr = header->attr[i];
1703 int j;
1704
1705 for (j = 0; j < attr->ids; j++) {
1706 if (attr->id[j] == id)
1707 return &attr->attr;
1708 }
1709 }
1710
1711 return NULL;
1712}
1713
1693static int 1714static int
1694process_read_event(event_t *event, unsigned long offset, unsigned long head) 1715process_read_event(event_t *event, unsigned long offset, unsigned long head)
1695{ 1716{
1696 dprintf("%p [%p]: PERF_EVENT_READ: %d %d %Lu\n", 1717 struct perf_counter_attr *attr = perf_header__find_attr(event->read.id);
1718
1719 dprintf("%p [%p]: PERF_EVENT_READ: %d %d %s %Lu\n",
1697 (void *)(offset + head), 1720 (void *)(offset + head),
1698 (void *)(long)(event->header.size), 1721 (void *)(long)(event->header.size),
1699 event->read.pid, 1722 event->read.pid,
1700 event->read.tid, 1723 event->read.tid,
1724 attr ? __event_name(attr->type, attr->config)
1725 : "FAIL",
1701 event->read.value); 1726 event->read.value);
1702 1727
1703 return 0; 1728 return 0;
@@ -1743,8 +1768,6 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
1743 return 0; 1768 return 0;
1744} 1769}
1745 1770
1746static struct perf_header *header;
1747
1748static u64 perf_header__sample_type(void) 1771static u64 perf_header__sample_type(void)
1749{ 1772{
1750 u64 sample_type = 0; 1773 u64 sample_type = 0;