aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2010-12-09 22:09:16 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-21 17:17:51 -0500
commit21ef97f05a7da5bc23b26cb34d6746f83ca9bf20 (patch)
treec47c09c178f7929f01dcb7b302ceed21f3758ded /tools/perf/builtin-diff.c
parent7639dae0ca11038286bbbcda05f2bef601c1eb8d (diff)
perf session: Fallback to unordered processing if no sample_id_all
If we are running the new perf on an old kernel without support for sample_id_all, we should fall back to the old unordered processing of events. If we didn't than we would *always* process events without timestamps out of order, whether or not we hit a reordering race. In other words, instead of there being a chance of not attributing samples correctly, we would guarantee that samples would not be attributed. While processing all events without timestamps before events with timestamps may seem like an intuitive solution, it falls down as PERF_RECORD_EXIT events would also be processed before any samples. Even with a workaround for that case, samples before/after an exec would not be attributed correctly. This patch allows commands to indicate whether they need to fall back to unordered processing, so that commands that do not care about timestamps on every event will not be affected. If we do fallback, this will print out a warning if report -D was invoked. This patch adds the test in perf_session__new so that we only need to test once per session. Commands that do not use an event_ops (such as record and top) can simply pass NULL in it's place. Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <1291951882-sup-6069@au1.ibm.com> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 5e1a043aae03..af84e1c0519d 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -142,8 +142,8 @@ static int __cmd_diff(void)
142 int ret, i; 142 int ret, i;
143 struct perf_session *session[2]; 143 struct perf_session *session[2];
144 144
145 session[0] = perf_session__new(input_old, O_RDONLY, force, false); 145 session[0] = perf_session__new(input_old, O_RDONLY, force, false, &event_ops);
146 session[1] = perf_session__new(input_new, O_RDONLY, force, false); 146 session[1] = perf_session__new(input_new, O_RDONLY, force, false, &event_ops);
147 if (session[0] == NULL || session[1] == NULL) 147 if (session[0] == NULL || session[1] == NULL)
148 return -ENOMEM; 148 return -ENOMEM;
149 149