diff mbox series

[03/35] perf ordered_events: Add ordered_events__last_flush_time()

Message ID 20220711093218.10967-4-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show
Series perf intel-pt: Add support for tracing virtual machine user space on the host | expand

Commit Message

Adrian Hunter July 11, 2022, 9:31 a.m. UTC
Allow callers to get the ordered_events last flush timestamp.

This is needed in perf inject to obey finished-round ordering when
injecting additional events (e.g. from a guest perf.data file) with
timestamps. Any additional events that have timestamps before the last
flush time must be injected before the corresponding FINISHED_ROUND event.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/ordered-events.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ian Rogers July 19, 2022, 4:56 p.m. UTC | #1
On Mon, Jul 11, 2022 at 2:32 AM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> Allow callers to get the ordered_events last flush timestamp.
>
> This is needed in perf inject to obey finished-round ordering when
> injecting additional events (e.g. from a guest perf.data file) with
> timestamps. Any additional events that have timestamps before the last
> flush time must be injected before the corresponding FINISHED_ROUND event.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/ordered-events.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/tools/perf/util/ordered-events.h b/tools/perf/util/ordered-events.h
> index 0b05c3c0aeaa..8febbd7c98ca 100644
> --- a/tools/perf/util/ordered-events.h
> +++ b/tools/perf/util/ordered-events.h
> @@ -75,4 +75,10 @@ void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy)
>  {
>         oe->copy_on_queue = copy;
>  }
> +
> +static inline u64 ordered_events__last_flush_time(struct ordered_events *oe)
> +{
> +       return oe->last_flush;
> +}
> +
>  #endif /* __ORDERED_EVENTS_H */
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/tools/perf/util/ordered-events.h b/tools/perf/util/ordered-events.h
index 0b05c3c0aeaa..8febbd7c98ca 100644
--- a/tools/perf/util/ordered-events.h
+++ b/tools/perf/util/ordered-events.h
@@ -75,4 +75,10 @@  void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy)
 {
 	oe->copy_on_queue = copy;
 }
+
+static inline u64 ordered_events__last_flush_time(struct ordered_events *oe)
+{
+	return oe->last_flush;
+}
+
 #endif /* __ORDERED_EVENTS_H */