diff options
-rw-r--r-- | tools/perf/builtin-report.c | 31 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 8 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 1 |
3 files changed, 35 insertions, 5 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 | ||
118 | typedef union event_union { | 120 | typedef union event_union { |
@@ -1690,14 +1692,37 @@ static void trace_event(event_t *event) | |||
1690 | dprintf(".\n"); | 1692 | dprintf(".\n"); |
1691 | } | 1693 | } |
1692 | 1694 | ||
1695 | static struct perf_header *header; | ||
1696 | |||
1697 | static 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 | |||
1693 | static int | 1714 | static int |
1694 | process_read_event(event_t *event, unsigned long offset, unsigned long head) | 1715 | process_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 | ||
1746 | static struct perf_header *header; | ||
1747 | |||
1748 | static u64 perf_header__sample_type(void) | 1771 | static u64 perf_header__sample_type(void) |
1749 | { | 1772 | { |
1750 | u64 sample_type = 0; | 1773 | u64 sample_type = 0; |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 7bdad8df22a6..f77407b5832e 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -223,9 +223,15 @@ char *event_name(int counter) | |||
223 | { | 223 | { |
224 | u64 config = attrs[counter].config; | 224 | u64 config = attrs[counter].config; |
225 | int type = attrs[counter].type; | 225 | int type = attrs[counter].type; |
226 | |||
227 | return __event_name(type, config); | ||
228 | } | ||
229 | |||
230 | char *__event_name(int type, u64 config) | ||
231 | { | ||
226 | static char buf[32]; | 232 | static char buf[32]; |
227 | 233 | ||
228 | if (attrs[counter].type == PERF_TYPE_RAW) { | 234 | if (type == PERF_TYPE_RAW) { |
229 | sprintf(buf, "raw 0x%llx", config); | 235 | sprintf(buf, "raw 0x%llx", config); |
230 | return buf; | 236 | return buf; |
231 | } | 237 | } |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 1ea5d09b6eb1..192a962e3a0f 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -10,6 +10,7 @@ extern int nr_counters; | |||
10 | extern struct perf_counter_attr attrs[MAX_COUNTERS]; | 10 | extern struct perf_counter_attr attrs[MAX_COUNTERS]; |
11 | 11 | ||
12 | extern char *event_name(int ctr); | 12 | extern char *event_name(int ctr); |
13 | extern char *__event_name(int type, u64 config); | ||
13 | 14 | ||
14 | extern int parse_events(const struct option *opt, const char *str, int unset); | 15 | extern int parse_events(const struct option *opt, const char *str, int unset); |
15 | 16 | ||