[patch 9/9] pref: session: Break event ordering when timestamps are missing

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Thomas Gleixner
Date: Tuesday, December 7, 2010 - 5:49 am

Allow the session client to specify that event ordering should be
stopped when not all events have time stamps.

Suggested-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 tools/perf/util/session.c |   13 ++++++++++++-
 tools/perf/util/session.h |    1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

Index: linux-2.6-tip/tools/perf/util/session.c
===================================================================
--- linux-2.6-tip.orig/tools/perf/util/session.c
+++ linux-2.6-tip/tools/perf/util/session.c
@@ -751,12 +751,23 @@ static int preprocess_sample_record(stru
 static int process_user_event(struct perf_session *session, event_t *event,
 			      struct perf_event_ops *ops, u64 file_offset)
 {
+	int ret;
+
 	dump_event(session, event, file_offset, NULL);
 
 	/* These events are processed right away */
 	switch (event->header.type) {
 	case PERF_RECORD_HEADER_ATTR:
-		return ops->attr(event, session);
+		/* This updates session->sample_id_all */
+		ret = ops->attr(event, session);
+		/* Break ordering if sample_id_all is false */
+		if (ops->ordering_requires_timestamps &&
+		    ops->ordered_samples && !session->sample_id_all) {
+			session->ordered_samples.next_flush = ULLONG_MAX;
+			flush_sample_queue(session, ops);
+			ops->ordered_samples = false;
+		}
+		return ret;
 	case PERF_RECORD_HEADER_EVENT_TYPE:
 		return ops->event_type(event, session);
 	case PERF_RECORD_HEADER_TRACING_DATA:
Index: linux-2.6-tip/tools/perf/util/session.h
===================================================================
--- linux-2.6-tip.orig/tools/perf/util/session.h
+++ linux-2.6-tip/tools/perf/util/session.h
@@ -78,6 +78,7 @@ struct perf_event_ops {
 			build_id;
 	event_op2	finished_round;
 	bool		ordered_samples;
+	bool		ordering_requires_timestamps;
 };
 
 struct perf_session *perf_session__new(const char *filename, int mode, bool force, bool repipe);


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 3/9] perf: session: Consolidate the dump code, Thomas Gleixner, (Tue Dec 7, 5:48 am)
[patch 7/9] perf: session: Split out sample preprocessing, Thomas Gleixner, (Tue Dec 7, 5:48 am)
[patch 8/9] perf: session: Split out user event processing, Thomas Gleixner, (Tue Dec 7, 5:49 am)
[patch 9/9] pref: session: Break event ordering when times ..., Thomas Gleixner, (Tue Dec 7, 5:49 am)
Re: [patch 0/9] perf: Consolidate the event handling and ..., Arnaldo Carvalho de Melo, (Wed Dec 8, 1:24 pm)
Re: [patch 9/9] pref: session: Break event ordering when t ..., Arnaldo Carvalho de Melo, (Thu Dec 9, 10:32 am)
[tip:perf/core] perf event: Prevent unbound event__name ar ..., tip-bot for Thomas G ..., (Thu Dec 9, 4:37 pm)
[tip:perf/core] perf session: Consolidate the dump code, tip-bot for Thomas G ..., (Thu Dec 9, 4:37 pm)
[tip:perf/core] perf session: Store file offset in sample_ ..., tip-bot for Thomas G ..., (Thu Dec 9, 4:38 pm)
[tip:perf/core] perf session: Add file_offset to event del ..., tip-bot for Thomas G ..., (Thu Dec 9, 4:38 pm)
[tip:perf/core] perf session: Move dump code to event deli ..., tip-bot for Thomas G ..., (Thu Dec 9, 4:38 pm)
[tip:perf/core] perf session: Split out sample preprocessing, tip-bot for Thomas G ..., (Thu Dec 9, 4:39 pm)