All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] tools, perf: Add a precise event qualifier v2
@ 2013-07-22 13:52 Andi Kleen
  2013-07-22 13:52 ` [PATCH 2/2] perf, x86: Enable PEBS mode automatically for mem-{loads,stores} v4 Andi Kleen
  2013-07-23  5:40 ` [PATCH 1/2] tools, perf: Add a precise event qualifier v2 Vince Weaver
  0 siblings, 2 replies; 22+ messages in thread
From: Andi Kleen @ 2013-07-22 13:52 UTC (permalink / raw)
  To: acme; +Cc: mingo, linux-kernel, Andi Kleen

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

Add a precise qualifier, like cpu/event=0x3c,precise=1/

This is needed so that the kernel can request enabling PEBS
on specific events. This is useful for mem-loads/mem-stores

Currently you have to known that mem-loads is a PEBS event
and use

perf record -e cpu/mem-loads/p ...

With this patch we can export the PEBSness of events in sysfs and
then allow

perf record -e cpu/mem-loads/ ...

or with the additional patch to automatically add cpu//

perf record -e mem-loads ...

Also useful for some other events added in later patches.

v2: Allow 3 as value
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/util/parse-events.c | 6 ++++++
 tools/perf/util/parse-events.h | 1 +
 tools/perf/util/parse-events.l | 1 +
 3 files changed, 8 insertions(+)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 995fc25..34f1470 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -568,6 +568,12 @@ do {								\
 	case PARSE_EVENTS__TERM_TYPE_NAME:
 		CHECK_TYPE_VAL(STR);
 		break;
+	case PARSE_EVENTS__TERM_TYPE_PRECISE:
+		CHECK_TYPE_VAL(NUM);
+		if ((unsigned)term->val.num > 3)
+			return -EINVAL;
+		attr->precise_ip = term->val.num;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 8a48593..13d7c66 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -48,6 +48,7 @@ enum {
 	PARSE_EVENTS__TERM_TYPE_NAME,
 	PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
 	PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
+	PARSE_EVENTS__TERM_TYPE_PRECISE,
 };
 
 struct parse_events_term {
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index e9d1134..32a9000 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -169,6 +169,7 @@ period			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
 branch_type		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
 ,			{ return ','; }
 "/"			{ BEGIN(INITIAL); return '/'; }
+precise			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PRECISE); }
 {name_minus}		{ return str(yyscanner, PE_NAME); }
 }
 
-- 
1.8.3.1


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

end of thread, other threads:[~2013-09-13 17:48 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22 13:52 [PATCH 1/2] tools, perf: Add a precise event qualifier v2 Andi Kleen
2013-07-22 13:52 ` [PATCH 2/2] perf, x86: Enable PEBS mode automatically for mem-{loads,stores} v4 Andi Kleen
2013-07-23  5:40 ` [PATCH 1/2] tools, perf: Add a precise event qualifier v2 Vince Weaver
2013-07-23  6:01   ` Andi Kleen
2013-07-23 21:27     ` Vince Weaver
2013-07-23 22:51       ` Andi Kleen
2013-07-24  0:39         ` Sasha Levin
2013-07-24  1:33           ` Andi Kleen
2013-07-24 18:31             ` Vince Weaver
2013-07-24 18:54           ` Vince Weaver
2013-07-24 18:47         ` Vince Weaver
2013-07-24 19:05           ` Andi Kleen
2013-07-26  3:58             ` Vince Weaver
2013-09-12 16:57         ` Ingo Molnar
2013-09-12 17:36           ` Andi Kleen
2013-09-12 17:59             ` Ingo Molnar
2013-09-13  8:56             ` Peter Zijlstra
2013-09-13  9:50               ` Ingo Molnar
2013-09-13 11:29                 ` Peter Zijlstra
2013-09-13 14:31                   ` Vince Weaver
2013-09-13 17:48               ` Andi Kleen
2013-09-12 19:35           ` Vince Weaver

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.