Skip to contentSkip to conversation

perf tools: Add non-architectural event aliases

RFC In review Jiri Olsa 4 participants 17 messages Jan 26, 2013 – May 4, 2013 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

v2 cover perf tools: Add non-architectural event aliases

hi,
adding support to use non-architectural events in perf via name, to be able to use them like:

$ perf stat -e 'cpu/IDQ.ALL_DSB_CYCLES/' ...
$ perf stat -e 'cpu/L2_STORE_LOCK_RQSTS.MISS/' ...
...

The perf list command displays current non-arch. events available:

$ perf list
...
  cpu/AGU_BYPASS_CANCEL.COUNT/                       [Kernel PMU event]
  cpu/ARITH.FPU_DIV/                                 [Kernel PMU event]
  cpu/ARITH.FPU_DIV_ACTIVE/                          [Kernel PMU event]
  cpu/BACLEARS.ANY/                                  [Kernel PMU event]
...

This version is dependent on precise changes:
http://marc.info/?l=linux-kernel&m=135922143117888&w=2

First version of this RFC is here:
http://marc.info/?l=linux-kernel&m=135575146128720&w=2

This version provides support for non-architectural events aliasses being defined in sigle files, like for SandyBridge:

$ cat arch/x86/events/intel/snb | head -5
name=AGU_BYPASS_CANCEL.COUNT,event=0xb6,umask=0x1
name=ARITH.FPU_DIV_ACTIVE,event=0x14,umask=0x1
name=ARITH.FPU_DIV,event=0x14,umask=0x10401
name=BACLEARS.ANY,event=0xe6,umask=0x1f
...

So far this is still under testing and only SandyBridge and IvyBridge events were added. I have no problem to add the rest of the archs. when the shape of this is agreed.

Available also at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/nonarch9

any comments are welcome,
jirka

---
Andi Kleen (1):
perf tools: List kernel supplied event aliases in perf list v2

Jiri Olsa (7):
perf tools: Add '.' as part of the event 'name' token perf tools: Change perf_pmu__new_alias function interface perf tools: Add name term processing for alias
perf tools: Add pmu interface to parse single file of aliases perf tools: Add support to include non architectural event aliases perf tools: Add non arch events for SandyBridge microarchitecture perf tools: Add non arch events for IvyBridge micro architecture

 tools/perf/Documentation/perf-list.txt |   4 +-
 tools/perf/arch/x86/Makefile           |  11 ++++
 tools/perf/arch/x86/events/intel/ivb   | 248 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/events/intel/snb   | 274 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/util/pmu.c         | 125 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/builtin-list.c              |   3 +
 tools/perf/util/parse-events.c         |  24 ++------
 tools/perf/util/parse-events.l         |   4 +-
 tools/perf/util/pmu.c                  | 158 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 tools/perf/util/pmu.h                  |   9 +++
 10 files changed, 824 insertions(+), 36 deletions(-)
author
#1 lore raw

PATCH v2 1/8 perf tools: Add '.' as part of the event 'name' token

Adding '.' to be recognized as valid part of the event 'name' token. Upcoming non architectural events use '.' as part of the name.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/parse-events.l | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/parse-events.l +2 -2
index 32a9000..4220093 100644
@@ -80,8 +80,8 @@ event		[^,{}/]+
 num_dec		[0-9]+
 num_hex		0x[a-fA-F0-9]+
 num_raw_hex	[a-fA-F0-9]+
-name		[a-zA-Z_*?][a-zA-Z0-9_*?]*
-name_minus	[a-zA-Z_*?][a-zA-Z0-9\-_*?]*
+name		[a-zA-Z_*?][a-zA-Z0-9_*?\.]*
+name_minus	[a-zA-Z_*?][a-zA-Z0-9\-_*?\.]*
 modifier_event	[ukhpGH]+
 modifier_bp	[rwx]{1,3}
 
Signature · 1 line
1.7.11.7
#2 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

Jiri,

I don't see part 0/8 of this series. Did you send it to me too?

I have some comments about it. I don't see why create something from scratch when I have been developing a library (libpfm4) that takes care of that and that is already used by many tool developers. That library can be linked with perf and provide full symbolic events + all the modifiers. The library is portable and supports all existing archs. It can also be used by self-monitoring apps.

You're introducing yet another event table to maintain. And believe me this is a lot of work to maintain this.

I don't understand why not use this existing library.

Quoted 36 lines · Jiri Olsa

Adding '.' to be recognized as valid part of the event 'name' token. Upcoming non architectural events use '.' as part of the name.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/parse-events.l | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/parse-events.l +2 -3
index 32a9000..4220093 100644
@@ -80,8 +80,8 @@ event         [^,{}/]+
 num_dec                [0-9]+
 num_hex                0x[a-fA-F0-9]+
 num_raw_hex    [a-fA-F0-9]+
-name           [a-zA-Z_*?][a-zA-Z0-9_*?]*
-name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?]*
+name           [a-zA-Z_*?][a-zA-Z0-9_*?\.]*
+name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?\.]*
 modifier_event [ukhpGH]+
 modifier_bp    [rwx]{1,3}
 
--

1.7.11.7

#3 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

Quoted 11 lines · Stephane Eranian

Jiri,

I don't see part 0/8 of this series. Did you send it to me too?

I have some comments about it. I don't see why create something from scratch when I have been developing a library (libpfm4) that takes care of that and that is already used by many tool developers. That library can be linked with perf and provide full symbolic events + all the modifiers. The library is portable and supports all existing archs. It can also be used by self-monitoring apps.

Quoted 5 lines

You're introducing yet another event table to maintain. And believe me this is a lot of work to maintain this.

I don't understand why not use this existing library.

I meant to add that I think it would be more productive if we (you and I) were to work on the library to extend it with external text-based event tables that could be used by perf either directly or thru the libpfm4 interface.

Quoted 38 lines · Jiri Olsa
Quoted 36 lines

Adding '.' to be recognized as valid part of the event 'name' token. Upcoming non architectural events use '.' as part of the name.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/parse-events.l | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/parse-events.l +2 -3
index 32a9000..4220093 100644
@@ -80,8 +80,8 @@ event         [^,{}/]+
 num_dec                [0-9]+
 num_hex                0x[a-fA-F0-9]+
 num_raw_hex    [a-fA-F0-9]+
-name           [a-zA-Z_*?][a-zA-Z0-9_*?]*
-name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?]*
+name           [a-zA-Z_*?][a-zA-Z0-9_*?\.]*
+name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?\.]*
 modifier_event [ukhpGH]+
 modifier_bp    [rwx]{1,3}
 
--

1.7.11.7

#4 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

Quoted 15 lines · Stephane Eranian
Quoted 14 lines · Stephane Eranian

Jiri,

I don't see part 0/8 of this series. Did you send it to me too?

I have some comments about it. I don't see why create something from scratch when I have been developing a library (libpfm4) that takes care of that and that is already used by many tool developers. That library can be linked with perf and provide full symbolic events + all the modifiers. The library is portable and supports all existing archs. It can also be used by self-monitoring apps.

You're introducing yet another event table to maintain. And believe me this is a lot of work to maintain this.

Quoted 7 lines
Quoted 2 lines

I don't understand why not use this existing library.

I meant to add that I think it would be more productive if we (you and I) were to work on the library to extend it with external text-based event tables that could be used by perf either directly or thru the libpfm4 interface.

perf is intentionally external file free and does not (fundamentally) depend on external libraries either, other than core system libraries.

There are several advantages to that:

- there is no version skew and no design/maintenance friction

- 'upgrading' perf between similar boxes is as simple as copying the perf binary

- it's self-sufficient

- there's no real advantage of external text files versus internal text files (i.e. text tables within the source code), while there are several disadvantages

So as long as Jiri is happy to maintain these tables I think it's a superior solution (even if the tables start out incomplete), from the perf project's perspective.

Thanks,

Ingo

author
#5 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Stephane Eranian
Quoted 3 lines · Stephane Eranian

Jiri,

I don't see part 0/8 of this series. Did you send it to me too?

oops, it went to lkml only, here it is:
http://marc.info/?l=linux-kernel&m=135923067520675&w=2

Quoted 27 lines
Quoted 11 lines
Quoted 11 lines

I have some comments about it. I don't see why create something from scratch when I have been developing a library (libpfm4) that takes care of that and that is already used by many tool developers. That library can be linked with perf and provide full symbolic events + all the modifiers. The library is portable and supports all existing archs. It can also be used by self-monitoring apps.

You're introducing yet another event table to maintain. And believe me this is a lot of work to maintain this.

Quoted 7 lines
Quoted 2 lines

I don't understand why not use this existing library.

I meant to add that I think it would be more productive if we (you and I) were to work on the library to extend it with external text-based event tables that could be used by perf either directly or thru the libpfm4 interface.

perf is intentionally external file free and does not (fundamentally) depend on external libraries either, other than core system libraries.

There are several advantages to that:

- there is no version skew and no design/maintenance friction

Quoted 8 lines

- 'upgrading' perf between similar boxes is as simple as copying the perf binary

- it's self-sufficient

- there's no real advantage of external text files versus internal text files (i.e. text tables within the source code), while there are several disadvantages

When you say 'internal'.. do you mean like inside binary internal?

Currently this file gets installed with perf and is loaded in run time based on the detected architecture.

Quoted 4 lines

So as long as Jiri is happy to maintain these tables I think it's a superior solution (even if the tables start out incomplete), from the perf project's perspective.

Actually what I did here was that I wrote a tool that sucked and get all the events from libpfm4 in the alias perf format.

It took some libpfm4 changes as well, so I did not post the tool source. But given that libpfm4 is not going in perf, this might be answer.. having tool to keep us in sync with libpfm4 and run it once in a while.. ;-)

jirka

#6 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

In reply to Ingo Molnar
Quoted 21 lines · Ingo Molnar
Quoted 18 lines · Stephane Eranian
Quoted 16 lines · Stephane Eranian

Jiri,

I don't see part 0/8 of this series. Did you send it to me too?

I have some comments about it. I don't see why create something from scratch when I have been developing a library (libpfm4) that takes care of that and that is already used by many tool developers. That library can be linked with perf and provide full symbolic events + all the modifiers. The library is portable and supports all existing archs. It can also be used by self-monitoring apps.

You're introducing yet another event table to maintain. And believe me this is a lot of work to maintain this.

I don't understand why not use this existing library.

Quoted 9 lines
Quoted 4 lines

I meant to add that I think it would be more productive if we (you and I) were to work on the library to extend it with external text-based event tables that could be used by perf either directly or thru the libpfm4 interface.

perf is intentionally external file free and does not (fundamentally) depend on external libraries either, other than core system libraries.

Perf does use external files, otherwise there would not be a need for what's in libexec.

As far as I know, perf is constantly adding dependencies to other libraries. For instance, nowadays, it does not compile if you don't have libnuma, libdw, and the likes. libpfm4 is similar in nature.

The goal of the library is to provide access to event table in a portable manner for tools and self-monitoring programs (on which they are many). Users don't have to have to change event names, event modifier syntax when they go from one tool to another. Or even when they switch from one OS to another. That's what libpfm4 provides and the scope goes beyond the perf tool.

Quoted 4 lines

There are several advantages to that:

- there is no version skew and no design/maintenance friction

There is rarely an version problem with event tables.

Quoted 3 lines

- 'upgrading' perf between similar boxes is as simple as copying the perf binary

Not quite.

Quoted 6 lines

- it's self-sufficient

- there's no real advantage of external text files versus internal text files (i.e. text tables within the source code), while there are several disadvantages

libpfm4 currently has the tables internally hardcoded.

Quoted 4 lines

So as long as Jiri is happy to maintain these tables I think it's a superior solution (even if the tables start out incomplete), from the perf project's perspective.

Adding the option for users to link with libpfm4 was no big deal in my mind. You are opposed to that. That's your choice. I don't buy your arguments for this patch series and will continue to provide a patch to link perf and libpfm4 for users who are interested.

I would have appreciated some discussion on this instead, once again, work was done behind closed door and thrown at my face. The worst being that as far I can see in the patches, no proper credits to libpfm4 contributors is even given for providing the raw information that allowed you to build your event tables without too much sweat! Building electronic event tables from vendor specs is a lot harder than it seems, but you may not know this.

author
#7 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

Quoted 5 lines · Stephane Eranian
Quoted 4 lines · Ingo Molnar
Quoted 1 line · Stephane Eranian

On Mon, Jan 28, 2013 at 9:52 PM, Stephane Eranian <[email protected]> wrote:

SNIP

Quoted 8 lines

Adding the option for users to link with libpfm4 was no big deal in my mind. You are opposed to that. That's your choice. I don't buy your arguments for this patch series and will continue to provide a patch to link perf and libpfm4 for users who are interested.

I would have appreciated some discussion on this instead, once again, work was done behind closed door and thrown at my face.

Not sure why you think it was 'closed door'.. I needed some way to access those events and sent RFC for it with you being on CC list.

Quoted 3 lines

The worst being that as far I can see in the patches, no proper credits to libpfm4 contributors is even given for providing the raw information that allowed you to build your event tables without too

Right, sorry for that.. I'll add it.

Quoted 2 lines

much sweat! Building electronic event tables from vendor specs is a lot harder than it seems, but you may not know this.

jirka

maintainer
#8 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

In reply to Stephane Eranian
Quoted 3 lines

I meant to add that I think it would be more productive if we (you and I) were to work on the library to extend it with external text-based event tables that could be used by perf either directly or thru the libpfm4 interface.

That would be very useful indeed.. I think we talked about this before. Also wasn't there some vendor support for this idea as well?

I think we want a format that is relatively simple to parse and human readable (which excludes XML on both counts ;-).

The main objection of using libpfm4 has always been that its primarily something else. It also does the event listing thing, but that's only a small part of it.

But if we can split out that part and use it in both projects that would be best I think.

#9 lore raw

Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token

Quoted 10 lines · Peter Zijlstra
Quoted 3 lines

I meant to add that I think it would be more productive if we (you and I) were to work on the library to extend it with external text-based event tables that could be used by perf either directly or thru the libpfm4 interface.

That would be very useful indeed.. I think we talked about this before. Also wasn't there some vendor support for this idea as well?

I think we want a format that is relatively simple to parse and human readable (which excludes XML on both counts ;-).

Quoted 6 lines

The main objection of using libpfm4 has always been that its primarily something else. It also does the event listing thing, but that's only a small part of it.

But if we can split out that part and use it in both projects that would be best I think.

If that libpfm reference library moved to tools/lib/ like tools/lib/traceevents/ then that would be a nice, useful solution indeed.

Thanks,

Ingo

author
#10 lore raw

PATCH v2 2/8 perf tools: Change perf_pmu__new_alias function interface

In reply to Jiri Olsa

Changing perf_pmu__new_alias interface not to work directly with FILE object, so it can be reused by other code paths coming in shortly.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/pmu.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
tools/perf/util/pmu.c +13 -10
index 4c6f9c4..f7852e9 100644
@@ -95,23 +95,17 @@ static int pmu_format(char *name, struct list_head *format)
 	return 0;
 }
 
-static int perf_pmu__new_alias(struct list_head *list, char *name, FILE *file)
+static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 {
 	struct perf_pmu_alias *alias;
-	char buf[256];
 	int ret;
 
-	ret = fread(buf, 1, sizeof(buf), file);
-	if (ret == 0)
-		return -EINVAL;
-	buf[ret] = 0;
-
 	alias = malloc(sizeof(*alias));
 	if (!alias)
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&alias->terms);
-	ret = parse_events_terms(&alias->terms, buf);
+	ret = parse_events_terms(&alias->terms, data);
 	if (ret) {
 		free(alias);
 		return ret;
@@ -137,7 +131,7 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 		return -EINVAL;
 
 	while (!ret && (evt_ent = readdir(event_dir))) {
-		char path[PATH_MAX];
+		char path[PATH_MAX], buf[256];
 		char *name = evt_ent->d_name;
 		FILE *file;
 
@@ -150,7 +144,16 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 		file = fopen(path, "r");
 		if (!file)
 			break;
-		ret = perf_pmu__new_alias(head, name, file);
+
+		ret = fread(buf, 1, sizeof(buf), file);
+		if (ret == 0) {
+			ret = -EINVAL;
+			break;
+		}
+
+		buf[ret] = 0;
+
+		ret = perf_pmu__new_alias(head, name, buf);
 		fclose(file);
 	}
 
Signature · 1 line
1.7.11.7
author
#11 lore raw

PATCH v2 3/8 perf tools: Add name term processing for alias

In reply to Jiri Olsa

Adding support for name term being specified within the alias definition and gives the name for the alias.

Alias could be now defined like:
name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff

It'll be handy for having single file with multiple alias definitions.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/parse-events.c | 19 ++-----------------
 tools/perf/util/pmu.c          | 35 +++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.h          |  3 +++
 3 files changed, 40 insertions(+), 17 deletions(-)
tools/perf/util/parse-events.c +2 -17
index 83362f2..0143c90 100644
@@ -616,22 +616,6 @@ int parse_events_add_numeric(struct list_head **list, int *idx,
 	return add_event(list, idx, &attr, NULL);
 }
 
-static int parse_events__is_name_term(struct parse_events_term *term)
-{
-	return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME;
-}
-
-static char *pmu_event_name(struct list_head *head_terms)
-{
-	struct parse_events_term *term;
-
-	list_for_each_entry(term, head_terms, list)
-		if (parse_events__is_name_term(term))
-			return term->val.str;
-
-	return NULL;
-}
-
 int parse_events_add_pmu(struct list_head **list, int *idx,
 			 char *name, struct list_head *head_config)
 {
@@ -656,7 +640,8 @@ int parse_events_add_pmu(struct list_head **list, int *idx,
 	if (perf_pmu__config(pmu, &attr, head_config))
 		return -EINVAL;
 
-	return __add_event(list, idx, &attr, pmu_event_name(head_config),
+	return __add_event(list, idx, &attr,
+			   perf_pmu__event_name(head_config, false),
 			   pmu->cpus);
 }
 
tools/perf/util/pmu.c +35 -0
index f7852e9..0d45ccd 100644
@@ -95,6 +95,27 @@ static int pmu_format(char *name, struct list_head *format)
 	return 0;
 }
 
+static int parse_events__is_name_term(struct parse_events_term *term)
+{
+	return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME;
+}
+
+char *perf_pmu__event_name(struct list_head *head_terms, bool remove)
+{
+	struct parse_events_term *term;
+
+	list_for_each_entry(term, head_terms, list)
+		if (parse_events__is_name_term(term)) {
+			if (remove) {
+				list_del(&term->list);
+				free(term);
+			}
+			return term->val.str;
+		}
+
+	return NULL;
+}
+
 static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 {
 	struct perf_pmu_alias *alias;
@@ -111,6 +132,20 @@ static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 		return ret;
 	}
 
+	/*
+	 * Use NAME term to get alias name. In case there's no name
+	 * at all, bail out. In case we find NAME term, remove it
+	 * not to mangle with event term name.
+	 */
+	if (!name) {
+		name = perf_pmu__event_name(&alias->terms, true);
+
+		if (!name) {
+			free(alias);
+			return -EINVAL;
+		}
+	}
+
 	alias->name = strdup(name);
 	list_add_tail(&alias->list, list);
 	return 0;
tools/perf/util/pmu.h +3 -0
index 32fe55b..54cd809 100644
@@ -3,6 +3,7 @@
 
 #include <linux/bitops.h>
 #include <linux/perf_event.h>
+#include <stdbool.h>
 
 enum {
 	PERF_PMU_FORMAT_VALUE_CONFIG,
@@ -40,5 +41,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head);
 
 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
+char *perf_pmu__event_name(struct list_head *head_terms, bool remove);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
Signature · 1 line
1.7.11.7
author
#12 lore raw

PATCH v2 4/8 perf tools: Add pmu interface to parse single file of aliases

In reply to Jiri Olsa

Adding pmu_aliases_parse_multi function to parse and add aliases from single file. The file format follows the alias format, each line for single alias. Each line must contains 'name' term, like:

name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff name=BR_MISP_EXEC.COND,event=0x89,umask=0x1

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/pmu.c | 23 +++++++++++++++++++++++
 tools/perf/util/pmu.h |  2 ++
 2 files changed, 25 insertions(+)
tools/perf/util/pmu.c +23 -0
index 0d45ccd..68d6c86 100644
@@ -146,11 +146,34 @@ static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 		}
 	}
 
+	pr_debug3("adding alias '%s' => '%s'\n", name, data);
+
 	alias->name = strdup(name);
 	list_add_tail(&alias->list, list);
 	return 0;
 }
 
+int pmu_aliases_parse_multi(char *path, struct list_head *head)
+{
+	FILE *file;
+	char *data = NULL;
+	size_t len;
+	int ret = -EINVAL;
+
+	file = fopen(path, "r");
+	if (!file)
+		return -EINVAL;
+
+	while ((getline(&data, &len, file)) != -1) {
+		ret = perf_pmu__new_alias(head, NULL, data);
+		free(data);
+		data = NULL;
+	}
+
+	fclose(file);
+	return ret;
+}
+
 /*
  * Process all the sysfs attributes located under the directory
  * specified in 'dir' parameter.
tools/perf/util/pmu.h +2 -0
index 54cd809..add249b 100644
@@ -43,5 +43,7 @@ struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
 char *perf_pmu__event_name(struct list_head *head_terms, bool remove);
 
+int pmu_aliases_parse_multi(char *path, struct list_head *head);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
Signature · 1 line
1.7.11.7
author
#13 lore raw

PATCH v2 5/8 perf tools: Add support to include non architectural event aliases

In reply to Jiri Olsa

Adding support to parse non architectural event aliases for given cpu. These aliases will be provided as single files parsed by pmu_aliases_parse_multi function.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/arch/x86/Makefile   |   7 +++
 tools/perf/arch/x86/util/pmu.c | 121 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.c          |  16 ++++--
 tools/perf/util/pmu.h          |   2 +
 4 files changed, 141 insertions(+), 5 deletions(-)
 create mode 100644 tools/perf/arch/x86/util/pmu.c
tools/perf/arch/x86/Makefile +7 -0
index 815841c..c175f65 100644
@@ -6,3 +6,10 @@ ifndef NO_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
 endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/pmu.o
+
+$(OUTPUT)$(OUTPUT)arch/$(ARCH)/util/pmu.o: $(OUTPUT)arch/$(ARCH)/util/pmu.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
+	 '-DPREFIX="$(prefix_SQ)"' \
+	 $<
tools/perf/arch/x86/util/pmu.c new file +121 -0

121 lines not on this page · raw message

tools/perf/util/pmu.c +11 -5
index 68d6c86..7c2908b 100644
@@ -219,6 +219,13 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 	return ret;
 }
 
+__attribute__((weak))
+int arch_pmu_aliases(char *name __maybe_unused,
+		     struct list_head *head __maybe_unused)
+{
+	return 0;
+}
+
 /*
  * Reading the pmu event aliases definition, which should be located at:
  * /sys/bus/event_source/devices/<dev>/events as sysfs group attributes.
@@ -236,13 +243,12 @@ static int pmu_aliases(char *name, struct list_head *head)
 	snprintf(path, PATH_MAX,
 		 "%s/bus/event_source/devices/%s/events", sysfs, name);
 
-	if (stat(path, &st) < 0)
-		return 0;	 /* no error if 'events' does not exist */
-
-	if (pmu_aliases_parse(path, head))
+	/* no error if 'events' does not exist */
+	if (!stat(path, &st) &&
+	    pmu_aliases_parse(path, head))
 		return -1;
 
-	return 0;
+	return arch_pmu_aliases(name, head);
 }
 
 static int pmu_alias_terms(struct perf_pmu_alias *alias,
tools/perf/util/pmu.h +2 -0
index add249b..aa049ea 100644
@@ -45,5 +45,7 @@ char *perf_pmu__event_name(struct list_head *head_terms, bool remove);
 
 int pmu_aliases_parse_multi(char *path, struct list_head *head);
 
+int arch_pmu_aliases(char *name, struct list_head *head);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
Signature · 1 line
1.7.11.7
author
#14 lore raw

PATCH v2 6/8 perf tools: Add non arch events for SandyBridge microarchitecture

In reply to Jiri Olsa

Adding non architectural event aliases for SandyBridge micro architecture.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/arch/x86/Makefile         |   4 +
 tools/perf/arch/x86/events/intel/snb | 274 +++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/util/pmu.c       |   4 +-
 3 files changed, 281 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/arch/x86/events/intel/snb
tools/perf/arch/x86/Makefile +4 -0
index c175f65..1db3f56 100644
@@ -13,3 +13,7 @@ $(OUTPUT)$(OUTPUT)arch/$(ARCH)/util/pmu.o: $(OUTPUT)arch/$(ARCH)/util/pmu.c $(OU
 	 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
 	 '-DPREFIX="$(prefix_SQ)"' \
 	 $<
+
+install:
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/events/x86/intel/'
+	$(INSTALL) -m 644 arch/$(ARCH)/events/intel/* $(DESTDIR_SQ)$(perfexec_instdir_SQ)/events/x86/intel/
tools/perf/arch/x86/events/intel/snb new file +274 -0

274 lines not on this page · raw message

tools/perf/arch/x86/util/pmu.c +3 -1
index a37da52..cac67d3 100644
@@ -56,8 +56,10 @@ static int intel_aliases(struct list_head *head, unsigned model)
 		return -1;
 
 	switch (model) {
+	case 42: /* Sandy Bridge (Core i7 26xx, 25xx) */
+	case 45: /* Sandy Bridge EP */
+		ADD_ALIASES("snb");
 	default:
-		ADD_ALIASES("");
 		break;
 	}
 
Signature · 1 line
1.7.11.7
author
#15 lore raw

PATCH v2 7/8 perf tools: Add non arch events for IvyBridge micro architecture

In reply to Jiri Olsa

Adding non architectural event aliases for IvyBridge micro architecture.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/arch/x86/events/intel/ivb | 248 +++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/util/pmu.c       |   2 +
 2 files changed, 250 insertions(+)
 create mode 100644 tools/perf/arch/x86/events/intel/ivb
tools/perf/arch/x86/events/intel/ivb new file +248 -0
new file mode 100644
index 0000000..b07535d
@@ -0,0 +1,248 @@
+name=ARITH.FPU_DIV_ACTIVE,event=0x14,umask=0x1
+name=ARITH.FPU_DIV,event=0x14,umask=0x10401
+name=BACLEARS.ANY,event=0xe6,umask=0x1f
+name=BR_INST_EXEC.NONTAKEN_COND,event=0x88,umask=0x41
+name=BR_INST_EXEC.TAKEN_COND,event=0x88,umask=0x81
+name=BR_INST_EXEC.NONTAKEN_DIRECT_JUMP,event=0x88,umask=0x42
+name=BR_INST_EXEC.TAKEN_DIRECT_JUMP,event=0x88,umask=0x82
+name=BR_INST_EXEC.NONTAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0x44
+name=BR_INST_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0x84
+name=BR_INST_EXEC.TAKEN_NEAR_RETURN,event=0x88,umask=0x88
+name=BR_INST_EXEC.TAKEN_DIRECT_NEAR_CALL,event=0x88,umask=0x90
+name=BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL,event=0x88,umask=0xa0
+name=BR_INST_EXEC.ALL_BRANCHES,event=0x88,umask=0xff
+name=BR_INST_EXEC.ALL_COND,event=0x88,umask=0xc1
+name=BR_INST_EXEC.ANY_COND,event=0x88,umask=0xc1
+name=BR_INST_EXEC.ANY_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0xc4
+name=BR_INST_EXEC.ANY_DIRECT_NEAR_CALL,event=0x88,umask=0xd0
+name=BR_INST_RETIRED.ALL_BRANCHES,event=0xc4,umask=0x4,precise
+name=BR_INST_RETIRED.COND,event=0xc4,umask=0x1,precise
+name=BR_INST_RETIRED.FAR_BRANCH,event=0xc4,umask=0x40,precise
+name=BR_INST_RETIRED.NEAR_CALL,event=0xc4,umask=0x2,precise
+name=BR_INST_RETIRED.NEAR_RETURN,event=0xc4,umask=0x8,precise
+name=BR_INST_RETIRED.NEAR_TAKEN,event=0xc4,umask=0x20,precise
+name=BR_INST_RETIRED.NOT_TAKEN,event=0xc4,umask=0x10,precise
+name=BR_MISP_EXEC.NONTAKEN_COND,event=0x89,umask=0x41
+name=BR_MISP_EXEC.TAKEN_COND,event=0x89,umask=0x81
+name=BR_MISP_EXEC.NONTAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0x44
+name=BR_MISP_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0x84
+name=BR_MISP_EXEC.NONTAKEN_NEAR_RETURN,event=0x89,umask=0x48
+name=BR_MISP_EXEC.TAKEN_NEAR_RETURN,event=0x89,umask=0x88
+name=BR_MISP_EXEC.NONTAKEN_DIRECT_NEAR_CALL,event=0x89,umask=0x50
+name=BR_MISP_EXEC.TAKEN_DIRECT_NEAR_CALL,event=0x89,umask=0x90
+name=BR_MISP_EXEC.NONTAKEN_INDIRECT_NEAR_CALL,event=0x89,umask=0x60
+name=BR_MISP_EXEC.TAKEN_INDIRECT_NEAR_CALL,event=0x89,umask=0xa0
+name=BR_MISP_EXEC.ANY_COND,event=0x89,umask=0xc1
+name=BR_MISP_EXEC.ANY_RETURN_NEAR,event=0x89,umask=0xc8
+name=BR_MISP_EXEC.ANY_DIRECT_NEAR_CALL,event=0x89,umask=0xd0
+name=BR_MISP_EXEC.ANY_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0xc4
+name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff
+name=BR_MISP_RETIRED.ALL_BRANCHES,event=0xc5,umask=0x4,precise
+name=BR_MISP_RETIRED.COND,event=0xc5,umask=0x1,precise
+name=BR_MISP_RETIRED.NEAR_CALL,event=0xc5,umask=0x2,precise
+name=BR_MISP_RETIRED.NOT_TAKEN,event=0xc5,umask=0x10,precise
+name=BR_MISP_RETIRED.TAKEN,event=0xc5,umask=0x20,precise
+name=LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION,event=0x63,umask=0x1
+name=LOCK_CYCLES.CACHE_LOCK_DURATION,event=0x63,umask=0x2
+name=CPL_CYCLES.RING0,event=0x5c,umask=0x1
+name=CPL_CYCLES.RING0_TRANS,event=0x5c,umask=0x10401
+name=CPL_CYCLES.RING123,event=0x5c,umask=0x2
+name=CPU_CLK_UNHALTED.REF_P,event=0x3c,umask=0x1
+name=CPU_CLK_UNHALTED.REF_XCLK,event=0x3c,umask=0x1
+name=CPU_CLK_UNHALTED.THREAD_P,event=0x3c,umask=0x0
+name=DSB2MITE_SWITCHES.COUNT,event=0xab,umask=0x1
+name=DSB2MITE_SWITCHES.PENALTY_CYCLES,event=0xab,umask=0x2
+name=DSB_FILL.EXCEED_DSB_LINES,event=0xac,umask=0x8
+name=DTLB_LOAD_MISSES.DEMAND_LD_MISS_CAUSES_A_WALK,event=0x8,umask=0x81
+name=DTLB_LOAD_MISSES.DEMAND_LD_WALK_COMPLETED,event=0x8,umask=0x82
+name=DTLB_LOAD_MISSES.DEMAND_LD_WALK_DURATION,event=0x8,umask=0x84
+name=DTLB_STORE_MISSES.MISS_CAUSES_A_WALK,event=0x49,umask=0x1
+name=DTLB_STORE_MISSES.CAUSES_A_WALK,event=0x49,umask=0x1
+name=DTLB_STORE_MISSES.STLB_HIT,event=0x49,umask=0x10
+name=DTLB_STORE_MISSES.WALK_COMPLETED,event=0x49,umask=0x2
+name=DTLB_STORE_MISSES.WALK_DURATION,event=0x49,umask=0x4
+name=FP_ASSIST.ANY,event=0xca,umask=0x1e
+name=FP_ASSIST.SIMD_INPUT,event=0xca,umask=0x10
+name=FP_ASSIST.SIMD_OUTPUT,event=0xca,umask=0x8
+name=FP_ASSIST.X87_INPUT,event=0xca,umask=0x4
+name=FP_ASSIST.X87_OUTPUT,event=0xca,umask=0x2
+name=HW_INTERRUPTS.RECEIVED,event=0xcb,umask=0x1
+name=ICACHE.MISSES,event=0x80,umask=0x2
+name=IDQ.EMPTY,event=0x79,umask=0x2
+name=IDQ.MITE_UOPS,event=0x79,umask=0x4
+name=IDQ.DSB_UOPS,event=0x79,umask=0x8
+name=IDQ.MS_DSB_UOPS,event=0x79,umask=0x10
+name=IDQ.MS_MITE_UOPS,event=0x79,umask=0x20
+name=IDQ.MS_UOPS,event=0x79,umask=0x30
+name=IDQ.MITE_UOPS_CYCLES,event=0x79,umask=0x10004
+name=IDQ.DSB_UOPS_CYCLES,event=0x79,umask=0x10008
+name=IDQ.MS_DSB_UOPS_CYCLES,event=0x79,umask=0x10010
+name=IDQ.MS_MITE_UOPS_CYCLES,event=0x79,umask=0x10020
+name=IDQ.MS_UOPS_CYCLES,event=0x79,umask=0x10030
+name=IDQ.ALL_DSB_UOPS,event=0x79,umask=0x18
+name=IDQ.ALL_DSB_CYCLES,event=0x79,umask=0x10018
+name=IDQ.ALL_DSB_CYCLES_4_UOPS,event=0x79,umask=0x40018
+name=IDQ.ALL_MITE_UOPS,event=0x79,umask=0x24
+name=IDQ.ALL_MITE_CYCLES,event=0x79,umask=0x10024
+name=IDQ.ANY_UOPS,event=0x79,umask=0x3c
+name=IDQ.MS_DSB_UOPS_OCCUR,event=0x79,umask=0x10410
+name=IDQ_UOPS_NOT_DELIVERED.CORE,event=0x9c,umask=0x1
+name=ILD_STALL.LCP,event=0x87,umask=0x1
+name=ILD_STALL.IQ_FULL,event=0x87,umask=0x4
+name=INST_RETIRED.ANY_P,event=0xc0,umask=0x0
+name=INST_RETIRED.ALL,event=0xc0,umask=0x1,precise
+name=INST_RETIRED.PREC_DIST,event=0xc0,umask=0x1,precise
+name=ITLB.ITLB_FLUSH,event=0xae,umask=0x1
+name=ITLB.FLUSH,event=0xae,umask=0x1
+name=ITLB_MISSES.MISS_CAUSES_A_WALK,event=0x85,umask=0x1
+name=ITLB_MISSES.CAUSES_A_WALK,event=0x85,umask=0x1
+name=ITLB_MISSES.STLB_HIT,event=0x85,umask=0x10
+name=ITLB_MISSES.WALK_COMPLETED,event=0x85,umask=0x2
+name=ITLB_MISSES.WALK_DURATION,event=0x85,umask=0x4
+name=L1D.REPLACEMENT,event=0x51,umask=0x1
+name=MOVE_ELIMINATION.INT_NOT_ELIMINATED,event=0x58,umask=0x1
+name=MOVE_ELIMINATION.SIMD_NOT_ELIMINATED,event=0x58,umask=0x2
+name=MOVE_ELIMINATION.INT_ELIMINATED,event=0x58,umask=0x4
+name=MOVE_ELIMINATION.SIMD_ELIMINATED,event=0x58,umask=0x2
+name=L1D_PEND_MISS.OCCURRENCES,event=0x48,umask=0x10401
+name=L1D_PEND_MISS.EDGE,event=0x48,umask=0x10401
+name=L1D_PEND_MISS.PENDING,event=0x48,umask=0x1
+name=L1D_PEND_MISS.PENDING_CYCLES,event=0x48,umask=0x10001
+name=L2_L1D_WB_RQSTS.HIT_E,event=0x28,umask=0x4
+name=L2_L1D_WB_RQSTS.HIT_M,event=0x28,umask=0x8
+name=L2_L1D_WB_RQSTS.MISS,event=0x28,umask=0x1
+name=L2_L1D_WB_RQSTS.ALL,event=0x28,umask=0xf
+name=L2_LINES_IN.ANY,event=0xf1,umask=0x7
+name=L2_LINES_IN.ALL,event=0xf1,umask=0x7
+name=L2_LINES_IN.E,event=0xf1,umask=0x4
+name=L2_LINES_IN.I,event=0xf1,umask=0x1
+name=L2_LINES_IN.S,event=0xf1,umask=0x2
+name=L2_LINES_OUT.DEMAND_CLEAN,event=0xf2,umask=0x1
+name=L2_LINES_OUT.DEMAND_DIRTY,event=0xf2,umask=0x2
+name=L2_LINES_OUT.PREFETCH_CLEAN,event=0xf2,umask=0x4
+name=L2_LINES_OUT.PF_CLEAN,event=0xf2,umask=0x4
+name=L2_LINES_OUT.PREFETCH_DIRTY,event=0xf2,umask=0x8
+name=L2_LINES_OUT.PF_DIRTY,event=0xf2,umask=0x8
+name=L2_LINES_OUT.DIRTY_ANY,event=0xf2,umask=0xa
+name=L2_LINES_OUT.DIRTY_ALL,event=0xf2,umask=0xa
+name=L2_RQSTS.ALL_CODE_RD,event=0x24,umask=0x30
+name=L2_RQSTS.CODE_RD_HIT,event=0x24,umask=0x10
+name=L2_RQSTS.CODE_RD_MISS,event=0x24,umask=0x20
+name=L2_RQSTS.ALL_DEMAND_DATA_RD,event=0x24,umask=0x3
+name=L2_RQSTS.DEMAND_DATA_RD_HIT,event=0x24,umask=0x1
+name=L2_RQSTS.ALL_PF,event=0x24,umask=0xc0
+name=L2_RQSTS.PF_HIT,event=0x24,umask=0x40
+name=L2_RQSTS.PF_MISS,event=0x24,umask=0x80
+name=L2_RQSTS.ALL_RFO,event=0x24,umask=0xc
+name=L2_RQSTS.RFO_HIT,event=0x24,umask=0x4
+name=L2_RQSTS.RFO_MISS,event=0x24,umask=0x8
+name=L2_STORE_LOCK_RQSTS.MISS,event=0x27,umask=0x1
+name=L2_STORE_LOCK_RQSTS.HIT_M,event=0x27,umask=0x8
+name=L2_STORE_LOCK_RQSTS.ALL,event=0x27,umask=0xf
+name=L2_TRANS.ALL,event=0xf0,umask=0x80
+name=L2_TRANS.CODE_RD,event=0xf0,umask=0x4
+name=L2_TRANS.L1D_WB,event=0xf0,umask=0x10
+name=L2_TRANS.DMND_DATA_RD,event=0xf0,umask=0x1
+name=L2_TRANS.L2_FILL,event=0xf0,umask=0x20
+name=L2_TRANS.L2_WB,event=0xf0,umask=0x40
+name=L2_TRANS.ALL_PREFETCH,event=0xf0,umask=0x8
+name=L2_TRANS.ALL_PF,event=0xf0,umask=0x8
+name=L2_TRANS.RFO,event=0xf0,umask=0x2
+name=LD_BLOCKS.STORE_FORWARD,event=0x3,umask=0x2
+name=LD_BLOCKS_PARTIAL.ADDRESS_ALIAS,event=0x7,umask=0x1
+name=LOAD_HIT_PRE.HW_PF,event=0x4c,umask=0x2
+name=LOAD_HIT_PRE.SW_PF,event=0x4c,umask=0x1
+name=L3_LAT_CACHE.MISS,event=0x2e,umask=0x41
+name=L3_LAT_CACHE.REFERENCE,event=0x2e,umask=0x4f
+name=MACHINE_CLEARS.MASKMOV,event=0xc3,umask=0x20
+name=MACHINE_CLEARS.MEMORY_ORDERING,event=0xc3,umask=0x2
+name=MACHINE_CLEARS.SMC,event=0xc3,umask=0x4
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT,event=0xd2,umask=0x2,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM,event=0xd2,umask=0x4,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS,event=0xd2,umask=0x1,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE,event=0xd2,umask=0x8,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_HIT,event=0xd2,umask=0x2,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_HITM,event=0xd2,umask=0x4,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_MISS,event=0xd2,umask=0x1,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_NONE,event=0xd2,umask=0x8,precise
+name=MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM,event=0xd3,umask=0x1,precise
+name=MEM_LOAD_UOPS_RETIRED.HIT_LFB,event=0xd1,umask=0x40,precise
+name=MEM_LOAD_UOPS_RETIRED.L1_HIT,event=0xd1,umask=0x1,precise
+name=MEM_LOAD_UOPS_RETIRED.L2_HIT,event=0xd1,umask=0x2,precise
+name=MEM_LOAD_UOPS_RETIRED.L3_HIT,event=0xd1,umask=0x4,precise
+name=MEM_LOAD_RETIRED.HIT_LFB,event=0xd1,umask=0x40,precise
+name=MEM_LOAD_RETIRED.L1_HIT,event=0xd1,umask=0x1,precise
+name=MEM_LOAD_RETIRED.L2_HIT,event=0xd1,umask=0x2,precise
+name=MEM_LOAD_RETIRED.L3_HIT,event=0xd1,umask=0x4,precise
+name=MEM_TRANS_RETIRED.LATENCY_ABOVE_THRESHOLD,event=0xcd,umask=0x1,precise
+name=MEM_TRANS_RETIRED.PRECISE_STORE,event=0xcd,umask=0x2,precise
+name=MEM_UOPS_RETIRED.ALL_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOPS_RETIRED.ANY_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOPS_RETIRED.ALL_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOPS_RETIRED.ANY_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOPS_RETIRED.LOCK_LOADS,event=0xd0,umask=0x21,precise
+name=MEM_UOPS_RETIRED.LOCK_STORES,event=0xd0,umask=0x22,precise
+name=MEM_UOPS_RETIRED.SPLIT_LOADS,event=0xd0,umask=0x41,precise
+name=MEM_UOPS_RETIRED.SPLIT_STORES,event=0xd0,umask=0x42,precise
+name=MEM_UOPS_RETIRED.STLB_MISS_LOADS,event=0xd0,umask=0x11,precise
+name=MEM_UOPS_RETIRED.STLB_MISS_STORES,event=0xd0,umask=0x12,precise
+name=MEM_UOP_RETIRED.ALL_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOP_RETIRED.ANY_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOP_RETIRED.ALL_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOP_RETIRED.ANY_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOP_RETIRED.LOCK_LOADS,event=0xd0,umask=0x21,precise
+name=MEM_UOP_RETIRED.LOCK_STORES,event=0xd0,umask=0x22,precise
+name=MEM_UOP_RETIRED.SPLIT_LOADS,event=0xd0,umask=0x41,precise
+name=MEM_UOP_RETIRED.SPLIT_STORES,event=0xd0,umask=0x42,precise
+name=MEM_UOP_RETIRED.STLB_MISS_LOADS,event=0xd0,umask=0x11,precise
+name=MEM_UOP_RETIRED.STLB_MISS_STORES,event=0xd0,umask=0x12,precise
+name=MISALIGN_MEM_REF.LOADS,event=0x5,umask=0x1
+name=MISALIGN_MEM_REF.STORES,event=0x5,umask=0x2
+name=OFFCORE_REQUESTS.ALL_DATA_RD,event=0xb0,umask=0x8
+name=OFFCORE_REQUESTS.ALL_DATA_READ,event=0xb0,umask=0x8
+name=OFFCORE_REQUESTS.DEMAND_CODE_RD,event=0xb0,umask=0x2
+name=OFFCORE_REQUESTS.DEMAND_DATA_RD,event=0xb0,umask=0x1
+name=OFFCORE_REQUESTS.DEMAND_RFO,event=0xb0,umask=0x4
+name=OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD_CYCLES,event=0x60,umask=0x10008
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD_CYCLES,event=0x60,umask=0x10002
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD_CYCLES,event=0x60,umask=0x10001
+name=OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD,event=0x60,umask=0x8
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD,event=0x60,umask=0x2
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD,event=0x60,umask=0x1
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO,event=0x60,umask=0x4
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO_CYCLES,event=0x60,umask=0x10004
+name=OTHER_ASSISTS.ITLB_MISS_RETIRED,event=0xc1,umask=0x2
+name=OTHER_ASSISTS.AVX_TO_SSE,event=0xc1,umask=0x10
+name=OTHER_ASSISTS.SSE_TO_AVX,event=0xc1,umask=0x20
+name=OTHER_ASSISTS.AVX_STORE,event=0xc1,umask=0x8
+name=RESOURCE_STALLS.ANY,event=0xa2,umask=0x1
+name=RESOURCE_STALLS.RS,event=0xa2,umask=0x4
+name=RESOURCE_STALLS.SB,event=0xa2,umask=0x8
+name=RESOURCE_STALLS.ROB,event=0xa2,umask=0x10
+name=ROB_MISC_EVENTS.LBR_INSERTS,event=0xcc,umask=0x20
+name=RS_EVENTS.EMPTY_CYCLES,event=0x5e,umask=0x1
+name=TLB_ACCESS.LOAD_STLB_HIT,event=0x5f,umask=0x1
+name=TLB_FLUSH.DTLB_THREAD,event=0xbd,umask=0x1
+name=TLB_FLUSH.STLB_ANY,event=0xbd,umask=0x20
+name=UOPS_EXECUTED.CORE,event=0xb1,umask=0x2
+name=UOPS_DISPATCHED_PORT.PORT_0,event=0xa1,umask=0x1
+name=UOPS_DISPATCHED_PORT.PORT_1,event=0xa1,umask=0x2
+name=UOPS_DISPATCHED_PORT.PORT_2_LD,event=0xa1,umask=0x4
+name=UOPS_DISPATCHED_PORT.PORT_2_STA,event=0xa1,umask=0x8
+name=UOPS_DISPATCHED_PORT.PORT_2,event=0xa1,umask=0xc
+name=UOPS_DISPATCHED_PORT.PORT_3_LD,event=0xa1,umask=0x10
+name=UOPS_DISPATCHED_PORT.PORT_3_STA,event=0xa1,umask=0x20
+name=UOPS_DISPATCHED_PORT.PORT_3,event=0xa1,umask=0x30
+name=UOPS_DISPATCHED_PORT.PORT_4,event=0xa1,umask=0x40
+name=UOPS_DISPATCHED_PORT.PORT_5,event=0xa1,umask=0x80
+name=UOPS_ISSUED.ANY,event=0xe,umask=0x1
+name=UOPS_ISSUED.CORE_STALL_CYCLES,event=0xe,umask=0x1a001
+name=UOPS_ISSUED.STALL_CYCLES,event=0xe,umask=0x18001
+name=UOPS_ISSUED.FLAGS_MERGE,event=0xe,umask=0x10
+name=UOPS_ISSUED.SLOW_LEA,event=0xe,umask=0x20
+name=UOPS_ISSUED.SINGLE_MUL,event=0xe,umask=0x40
+name=UOPS_RETIRED.ALL,event=0xc2,umask=0x1,precise
+name=UOPS_RETIRED.ANY,event=0xc2,umask=0x1,precise
+name=UOPS_RETIRED.RETIRE_SLOTS,event=0xc2,umask=0x2,precise
+name=UOPS_RETIRED.STALL_CYCLES,event=0xc2,umask=0x18001,precise
+name=UOPS_RETIRED.TOTAL_CYCLES,event=0xc2,umask=0x100001,precise
tools/perf/arch/x86/util/pmu.c +2 -0
index cac67d3..d6250f4 100644
@@ -59,6 +59,8 @@ static int intel_aliases(struct list_head *head, unsigned model)
 	case 42: /* Sandy Bridge (Core i7 26xx, 25xx) */
 	case 45: /* Sandy Bridge EP */
 		ADD_ALIASES("snb");
+	case 58: /* IvyBridge */
+		ADD_ALIASES("ivb");
 	default:
 		break;
 	}
Signature · 1 line
1.7.11.7
author
#16 lore raw

PATCH v2 8/8 perf tools: List kernel supplied event aliases in perf list v2

In reply to Jiri Olsa

From: Andi Kleen <[email protected]>

List the kernel supplied pmu event aliases in perf list

It's better when the users can actually see them.

v2: Fix pattern matching

[ removed 'OR' alternative syntax from display & changed subject ]
[ rebased to latest perf tool changes ]
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Documentation/perf-list.txt |  4 ++-
 tools/perf/builtin-list.c              |  3 ++
 tools/perf/util/parse-events.c         |  5 ++-
 tools/perf/util/pmu.c                  | 61 ++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.h                  |  2 ++
 5 files changed, 73 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-list.txt +3 -1
index d1e39dc..826f3d6 100644
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types
 SYNOPSIS
 --------
 [verse]
-'perf list' [hw|sw|cache|tracepoint|event_glob]
+'perf list' [hw|sw|cache|tracepoint|pmu|event_glob]
 
 DESCRIPTION
 -----------
@@ -104,6 +104,8 @@ To limit the list use:
   'subsys_glob:event_glob' to filter by tracepoint subsystems such as sched,
   block, etc.
 
+. 'pmu' to print the kernel supplied PMU events.
+
 . If none of the above is matched, it will apply the supplied glob to all
   events, printing the ones that match.
 
tools/perf/builtin-list.c +3 -0
index 1948ece..e79f423 100644
@@ -13,6 +13,7 @@
 
 #include "util/parse-events.h"
 #include "util/cache.h"
+#include "util/pmu.h"
 
 int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 {
@@ -37,6 +38,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 			else if (strcmp(argv[i], "cache") == 0 ||
 				 strcmp(argv[i], "hwcache") == 0)
 				print_hwcache_events(NULL, false);
+			else if (strcmp(argv[i], "pmu") == 0)
+				print_pmu_events(NULL, false);
 			else if (strcmp(argv[i], "--raw-dump") == 0)
 				print_events(NULL, true);
 			else {
tools/perf/util/parse-events.c +4 -1
index 0143c90..d7ebe10 100644
@@ -1088,6 +1088,8 @@ int print_hwcache_events(const char *event_glob, bool name_only)
 		}
 	}
 
+	if (printed)
+		printf("\n");
 	return printed;
 }
 
@@ -1142,11 +1144,12 @@ void print_events(const char *event_glob, bool name_only)
 
 	print_hwcache_events(event_glob, name_only);
 
+	print_pmu_events(event_glob, name_only);
+
 	if (event_glob != NULL)
 		return;
 
 	if (!name_only) {
-		printf("\n");
 		printf("  %-50s [%s]\n",
 		       "rNNN",
 		       event_type_descriptors[PERF_TYPE_RAW]);
tools/perf/util/pmu.c +61 -0

64 lines not on this page · raw message

tools/perf/util/pmu.h +2 -0
index aa049ea..eaaf9c60 100644
@@ -47,5 +47,7 @@ int pmu_aliases_parse_multi(char *path, struct list_head *head);
 
 int arch_pmu_aliases(char *name, struct list_head *head);
 
+void print_pmu_events(const char *event_glob, bool name_only);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
Signature · 1 line
1.7.11.7