[PATCH] perf parse-events: Set exclude_guest for user-space counting
From: Jin Yao
Date: Wed Aug 12 2020 - 03:00:33 EST
Currently if we run 'perf record -e cycles:u', exclude_guest is 0.
But it doesn't make sense that we request for user-space counting
but we also get the guest report.
To keep perf semantics consistent and clear, this patch sets
exclude_guest for user-space counting.
Signed-off-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
---
tools/perf/util/parse-events.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 9f7260e69113..4d809f1fe269 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1794,6 +1794,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
if (*str == 'u') {
if (!exclude)
exclude = eu = ek = eh = 1;
+ if (!exclude_GH)
+ eG = 1;
eu = 0;
} else if (*str == 'k') {
if (!exclude)
--
2.17.1