diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 99274cec0adb..41639182fb3f 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "util/string.h" | 17 | #include "util/string.h" |
18 | #include "util/callchain.h" | 18 | #include "util/callchain.h" |
19 | #include "util/strlist.h" | 19 | #include "util/strlist.h" |
20 | #include "util/values.h" | ||
20 | 21 | ||
21 | #include "perf.h" | 22 | #include "perf.h" |
22 | #include "util/header.h" | 23 | #include "util/header.h" |
@@ -53,6 +54,9 @@ static int modules; | |||
53 | static int full_paths; | 54 | static int full_paths; |
54 | static int show_nr_samples; | 55 | static int show_nr_samples; |
55 | 56 | ||
57 | static int show_threads; | ||
58 | static struct perf_read_values show_threads_values; | ||
59 | |||
56 | static unsigned long page_size; | 60 | static unsigned long page_size; |
57 | static unsigned long mmap_window = 32; | 61 | static unsigned long mmap_window = 32; |
58 | 62 | ||
@@ -1473,6 +1477,9 @@ print_entries: | |||
1473 | 1477 | ||
1474 | free(rem_sq_bracket); | 1478 | free(rem_sq_bracket); |
1475 | 1479 | ||
1480 | if (show_threads) | ||
1481 | perf_read_values_display(fp, &show_threads_values); | ||
1482 | |||
1476 | return ret; | 1483 | return ret; |
1477 | } | 1484 | } |
1478 | 1485 | ||
@@ -1758,6 +1765,16 @@ process_read_event(event_t *event, unsigned long offset, unsigned long head) | |||
1758 | { | 1765 | { |
1759 | struct perf_counter_attr *attr = perf_header__find_attr(event->read.id); | 1766 | struct perf_counter_attr *attr = perf_header__find_attr(event->read.id); |
1760 | 1767 | ||
1768 | if (show_threads) { | ||
1769 | char *name = attr ? __event_name(attr->type, attr->config) | ||
1770 | : "unknown"; | ||
1771 | perf_read_values_add_value(&show_threads_values, | ||
1772 | event->read.pid, event->read.tid, | ||
1773 | event->read.id, | ||
1774 | name, | ||
1775 | event->read.value); | ||
1776 | } | ||
1777 | |||
1761 | dprintf("%p [%p]: PERF_EVENT_READ: %d %d %s %Lu\n", | 1778 | dprintf("%p [%p]: PERF_EVENT_READ: %d %d %s %Lu\n", |
1762 | (void *)(offset + head), | 1779 | (void *)(offset + head), |
1763 | (void *)(long)(event->header.size), | 1780 | (void *)(long)(event->header.size), |
@@ -1839,6 +1856,9 @@ static int __cmd_report(void) | |||
1839 | 1856 | ||
1840 | register_idle_thread(); | 1857 | register_idle_thread(); |
1841 | 1858 | ||
1859 | if (show_threads) | ||
1860 | perf_read_values_init(&show_threads_values); | ||
1861 | |||
1842 | input = open(input_name, O_RDONLY); | 1862 | input = open(input_name, O_RDONLY); |
1843 | if (input < 0) { | 1863 | if (input < 0) { |
1844 | fprintf(stderr, " failed to open file: %s", input_name); | 1864 | fprintf(stderr, " failed to open file: %s", input_name); |
@@ -1993,6 +2013,9 @@ done: | |||
1993 | output__resort(total); | 2013 | output__resort(total); |
1994 | output__fprintf(stdout, total); | 2014 | output__fprintf(stdout, total); |
1995 | 2015 | ||
2016 | if (show_threads) | ||
2017 | perf_read_values_destroy(&show_threads_values); | ||
2018 | |||
1996 | return rc; | 2019 | return rc; |
1997 | } | 2020 | } |
1998 | 2021 | ||
@@ -2066,6 +2089,8 @@ static const struct option options[] = { | |||
2066 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | 2089 | "load module symbols - WARNING: use only with -k and LIVE kernel"), |
2067 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, | 2090 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, |
2068 | "Show a column with the number of samples"), | 2091 | "Show a column with the number of samples"), |
2092 | OPT_BOOLEAN('T', "threads", &show_threads, | ||
2093 | "Show per-thread event counters"), | ||
2069 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 2094 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
2070 | "sort by key(s): pid, comm, dso, symbol, parent"), | 2095 | "sort by key(s): pid, comm, dso, symbol, parent"), |
2071 | OPT_BOOLEAN('P', "full-paths", &full_paths, | 2096 | OPT_BOOLEAN('P', "full-paths", &full_paths, |