struct list_head        list;
 };
 
+enum oe_flush {
+       OE_FLUSH__FINAL,
+       OE_FLUSH__ROUND,
+};
+
 static void perf_session_free_sample_buffers(struct perf_session *session)
 {
        struct ordered_events *oe = &session->ordered_events;
                                      struct perf_tool *tool,
                                      u64 file_offset);
 
-static int ordered_events__flush(struct perf_session *s,
-                                struct perf_tool *tool)
+static int __ordered_events__flush(struct perf_session *s,
+                                  struct perf_tool *tool)
 {
        struct ordered_events *oe = &s->ordered_events;
        struct list_head *head = &oe->events;
        return 0;
 }
 
+static int ordered_events__flush(struct perf_session *s, struct perf_tool *tool,
+                                enum oe_flush how)
+{
+       struct ordered_events *oe = &s->ordered_events;
+       int err;
+
+       switch (how) {
+       case OE_FLUSH__FINAL:
+               oe->next_flush = ULLONG_MAX;
+               break;
+
+       case OE_FLUSH__ROUND:
+       default:
+               break;
+       };
+
+       err = __ordered_events__flush(s, tool);
+
+       if (!err) {
+               if (how == OE_FLUSH__ROUND)
+                       oe->next_flush = oe->max_timestamp;
+       }
+
+       return err;
+}
+
 /*
  * When perf record finishes a pass on every buffers, it records this pseudo
  * event.
                                  union perf_event *event __maybe_unused,
                                  struct perf_session *session)
 {
-       int ret = ordered_events__flush(session, tool);
-       if (!ret)
-               session->ordered_events.next_flush = session->ordered_events.max_timestamp;
-
-       return ret;
+       return ordered_events__flush(session, tool, OE_FLUSH__ROUND);
 }
 
 int perf_session_queue_event(struct perf_session *s, union perf_event *event,
                goto more;
 done:
        /* do the final flush for ordered samples */
-       session->ordered_events.next_flush = ULLONG_MAX;
-       err = ordered_events__flush(session, tool);
+       err = ordered_events__flush(session, tool, OE_FLUSH__FINAL);
 out_err:
        free(buf);
        perf_session__warn_about_errors(session, tool);
 
 out:
        /* do the final flush for ordered samples */
-       session->ordered_events.next_flush = ULLONG_MAX;
-       err = ordered_events__flush(session, tool);
+       err = ordered_events__flush(session, tool, OE_FLUSH__FINAL);
 out_err:
        ui_progress__finish();
        perf_session__warn_about_errors(session, tool);