From: Andi Kleen <a...@linux.intel.com> The first first element in an hardware event name defines the general area, usually the part of the micro architecture it is refering to. Group the perf list output by these sections by adding section headers.
Signed-off-by: Andi Kleen <a...@linux.intel.com> Signed-off-by: Sukadev Bhattiprolu <suka...@linux.vnet.ibm.com> --- tools/perf/util/pmu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 417333b..8d91fa7 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1039,6 +1039,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) struct pair *aliases; int numdesc = 0; int columns = pager_get_columns(); + const char *last_section; + int last_section_len; pmu = NULL; len = 0; @@ -1086,6 +1088,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) } } len = j; + last_section = NULL; + last_section_len = 0; qsort(aliases, len, sizeof(struct pair), cmp_pair); for (j = 0; j < len; j++) { if (name_only) { @@ -1093,8 +1097,21 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) continue; } if (aliases[j].desc && !quiet_flag) { + char *dot; + char *name = aliases[j].name; + if (numdesc++ == 0) printf("\n"); + dot = strchr(name, '.'); + if (dot && + (!last_section || + strncmp(last_section, name, last_section_len))) { + last_section_len = dot - name; + printf("%s%.*s:\n", + last_section ? "\n" : "", + last_section_len, name); + last_section = name; + } printf(" %-50s\n", aliases[j].name); printf("%*s", 8, "["); wordwrap(aliases[j].desc, 8, columns, 0); -- 1.7.9.5 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev