mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: sukadev@linux.vnet.ibm.com
Cc: jolsa@redhat.com, mingo@kernel.org, acme@kernel.org,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 1/2] perf, tools: Group alias perf list by section
Date: Thu, 28 May 2015 10:49:20 -0700	[thread overview]
Message-ID: <1432835361-16964-2-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1432835361-16964-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@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 <ak@linux.intel.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 578a537..ba50300 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -982,6 +982,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;
@@ -1029,6 +1031,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) {
@@ -1036,8 +1040,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);
-- 
2.1.0


  reply	other threads:[~2015-05-28 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 17:49 perf: Support grouped event lists Andi Kleen
2015-05-28 17:49 ` Andi Kleen [this message]
2015-05-28 17:49 ` [PATCH 2/2] perf, tools: Add override support for event list CPUID Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432835361-16964-2-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®