mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* perf: Support grouped event lists
@ 2015-05-28 17:49 Andi Kleen
  2015-05-28 17:49 ` [PATCH 1/2] perf, tools: Group alias perf list by section Andi Kleen
  2015-05-28 17:49 ` [PATCH 2/2] perf, tools: Add override support for event list CPUID Andi Kleen
  0 siblings, 2 replies; 3+ messages in thread
From: Andi Kleen @ 2015-05-28 17:49 UTC (permalink / raw)
  To: sukadev; +Cc: jolsa, mingo, acme, linux-kernel

As requested, this patchkit supports grouped event lists, by using
the stem as the section header. In addition it adds CPU override
support, which is useful for testing.

The updated Intel event lists with redundant entries removed are available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git perf/intel-json-files-2

% perf list
...
icache:
  icache.hit                                        
       [Number of Instruction Cache, Streaming Buffer and Victim Cache Reads. both cacheable and noncacheable, including UC fetches]
  icache.ifetch_stall                               
       [Cycles where a code-fetch stalled due to L1 instruction-cache miss or an iTLB miss]
...
idq:
  idq.all_dsb_cycles_4_uops                         
       [Cycles Decode Stream Buffer (DSB) is delivering 4 Uops]
  idq.all_dsb_cycles_any_uops                       
       [Cycles Decode Stream Buffer (DSB) is delivering any Uop]
  idq.all_mite_cycles_4_uops                        
       [Cycles MITE is delivering 4 Uops]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] perf, tools: Group alias perf list by section
  2015-05-28 17:49 perf: Support grouped event lists Andi Kleen
@ 2015-05-28 17:49 ` Andi Kleen
  2015-05-28 17:49 ` [PATCH 2/2] perf, tools: Add override support for event list CPUID Andi Kleen
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2015-05-28 17:49 UTC (permalink / raw)
  To: sukadev; +Cc: jolsa, mingo, acme, linux-kernel, Andi Kleen

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] perf, tools: Add override support for event list CPUID
  2015-05-28 17:49 perf: Support grouped event lists Andi Kleen
  2015-05-28 17:49 ` [PATCH 1/2] perf, tools: Group alias perf list by section Andi Kleen
@ 2015-05-28 17:49 ` Andi Kleen
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2015-05-28 17:49 UTC (permalink / raw)
  To: sukadev; +Cc: jolsa, mingo, acme, linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Add a PERF_CPUID variable to override the CPUID of the current CPU.
This is useful for testing, so that all event lists can be tested on a single
system.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/util/pmu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index ba50300..5500126 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -474,7 +474,9 @@ static int pmu_add_cpu_aliases(void *data)
 	struct pmu_event *pe;
 	char *cpuid;
 
-	cpuid = get_cpuid_str();
+	cpuid = getenv("PERF_CPUID");
+	if (!cpuid)
+		cpuid = get_cpuid_str();
 	if (!cpuid)
 		return 0;
 
-- 
2.1.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-28 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28 17:49 perf: Support grouped event lists Andi Kleen
2015-05-28 17:49 ` [PATCH 1/2] perf, tools: Group alias perf list by section Andi Kleen
2015-05-28 17:49 ` [PATCH 2/2] perf, tools: Add override support for event list CPUID Andi Kleen

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®