diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/annotate.c | 9 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 24 |
2 files changed, 27 insertions, 6 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 0955cff5b0ef..f080cc40f00b 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -649,9 +649,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st | |||
649 | 649 | ||
650 | next = disasm__get_next_ip_line(¬es->src->source, dl); | 650 | next = disasm__get_next_ip_line(¬es->src->source, dl); |
651 | 651 | ||
652 | if (symbol_conf.event_group && | 652 | if (perf_evsel__is_group_event(evsel)) { |
653 | perf_evsel__is_group_leader(evsel) && | ||
654 | evsel->nr_members > 1) { | ||
655 | nr_percent = evsel->nr_members; | 653 | nr_percent = evsel->nr_members; |
656 | ppercents = calloc(nr_percent, sizeof(double)); | 654 | ppercents = calloc(nr_percent, sizeof(double)); |
657 | if (ppercents == NULL) | 655 | if (ppercents == NULL) |
@@ -721,8 +719,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st | |||
721 | if (queue) | 719 | if (queue) |
722 | return -1; | 720 | return -1; |
723 | 721 | ||
724 | if (symbol_conf.event_group && | 722 | if (perf_evsel__is_group_event(evsel)) |
725 | perf_evsel__is_group_leader(evsel)) | ||
726 | width *= evsel->nr_members; | 723 | width *= evsel->nr_members; |
727 | 724 | ||
728 | if (!*dl->line) | 725 | if (!*dl->line) |
@@ -1126,7 +1123,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
1126 | len = symbol__size(sym); | 1123 | len = symbol__size(sym); |
1127 | namelen = strlen(d_filename); | 1124 | namelen = strlen(d_filename); |
1128 | 1125 | ||
1129 | if (symbol_conf.event_group && perf_evsel__is_group_leader(evsel)) | 1126 | if (perf_evsel__is_group_event(evsel)) |
1130 | width *= evsel->nr_members; | 1127 | width *= evsel->nr_members; |
1131 | 1128 | ||
1132 | printf(" %-*.*s| Source code & Disassembly of %s\n", | 1129 | printf(" %-*.*s| Source code & Disassembly of %s\n", |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 52021c3087df..bf758e53c929 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "xyarray.h" | 9 | #include "xyarray.h" |
10 | #include "cgroup.h" | 10 | #include "cgroup.h" |
11 | #include "hist.h" | 11 | #include "hist.h" |
12 | #include "symbol.h" | ||
12 | 13 | ||
13 | struct perf_counts_values { | 14 | struct perf_counts_values { |
14 | union { | 15 | union { |
@@ -246,11 +247,34 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) | |||
246 | return list_entry(evsel->node.next, struct perf_evsel, node); | 247 | return list_entry(evsel->node.next, struct perf_evsel, node); |
247 | } | 248 | } |
248 | 249 | ||
250 | /** | ||
251 | * perf_evsel__is_group_leader - Return whether given evsel is a leader event | ||
252 | * | ||
253 | * @evsel - evsel selector to be tested | ||
254 | * | ||
255 | * Return %true if @evsel is a group leader or a stand-alone event | ||
256 | */ | ||
249 | static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel) | 257 | static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel) |
250 | { | 258 | { |
251 | return evsel->leader == evsel; | 259 | return evsel->leader == evsel; |
252 | } | 260 | } |
253 | 261 | ||
262 | /** | ||
263 | * perf_evsel__is_group_event - Return whether given evsel is a group event | ||
264 | * | ||
265 | * @evsel - evsel selector to be tested | ||
266 | * | ||
267 | * Return %true iff event group view is enabled and @evsel is a actual group | ||
268 | * leader which has other members in the group | ||
269 | */ | ||
270 | static inline bool perf_evsel__is_group_event(struct perf_evsel *evsel) | ||
271 | { | ||
272 | if (!symbol_conf.event_group) | ||
273 | return false; | ||
274 | |||
275 | return perf_evsel__is_group_leader(evsel) && evsel->nr_members > 1; | ||
276 | } | ||
277 | |||
254 | struct perf_attr_details { | 278 | struct perf_attr_details { |
255 | bool freq; | 279 | bool freq; |
256 | bool verbose; | 280 | bool verbose; |