[PATCH 6/9] perf tools: Favor 'p' modifier before 'precise' term properly

From: Jiri Olsa
Date: Sat Jan 26 2013 - 12:29:30 EST


The 'p' event modifier is stronger than setting precise_ip
using the 'precise' term, like:

'cpu/cycles,precise/' - precise_ip = sysfs precise value
'cpu/cycles,precise/p' - precise_ip = 1

There's currently bug if the event modifier without 'p' is
specified the precise_ip is set to zero, like:

'cpu/cycles,precise/u' - precise_ip = 0

This patch makes sure that the precise_ip value is overwritten
only if any 'p' event modifier is specified, like:

'cpu/cycles,precise/u' - precise_ip = sysfs precise value

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
---
tools/perf/util/parse-events.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index a92c403..83362f2 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -818,7 +818,14 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
evsel->attr.exclude_user = mod.eu;
evsel->attr.exclude_kernel = mod.ek;
evsel->attr.exclude_hv = mod.eh;
- evsel->attr.precise_ip = mod.precise;
+
+ /*
+ * Change precise only if it's defined, so we don't
+ * overwrite 'precise' term if there's no 'p' modifier.
+ */
+ if (mod.precise)
+ evsel->attr.precise_ip = mod.precise;
+
evsel->attr.exclude_host = mod.eH;
evsel->attr.exclude_guest = mod.eG;
evsel->exclude_GH = mod.exclude_GH;
--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/