Re: [PATCH 04/35] perf tools: Export perf_event__process_finished_round()

Ian Rogers
2022-07-19T17:04:28Z

On Mon, Jul 11, 2022 at 2:32 AM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> Export perf_event__process_finished_round() so it can be used elsewhere.
>
> This is needed in perf inject to obey finished-round ordering.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/util/session.c | 12 ++++--------
> tools/perf/util/session.h | 4 ++++
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 37f833c3c81b..4c9513bc6d89 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -374,10 +374,6 @@ static int process_finished_round_stub(struct perf_tool *tool __maybe_unused,
> return 0;
> }
>
> -static int process_finished_round(struct perf_tool *tool,
> - union perf_event *event,
> - struct ordered_events *oe);
> -
> static int skipn(int fd, off_t n)
> {
> char buf[4096];
> @@ -534,7 +530,7 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
> tool->build_id = process_event_op2_stub;
> if (tool->finished_round == NULL) {
> if (tool->ordered_events)
> - tool->finished_round = process_finished_round;
> + tool->finished_round = perf_event__process_finished_round;
> else
> tool->finished_round = process_finished_round_stub;
> }
> @@ -1069,9 +1065,9 @@ static perf_event__swap_op perf_event__swap_ops[] = {
> * Flush every events below timestamp 7
> * etc...
> */
> -static int process_finished_round(struct perf_tool *tool __maybe_unused,
> - union perf_event *event __maybe_unused,
> - struct ordered_events *oe)
> +int perf_event__process_finished_round(struct perf_tool *tool __maybe_unused,
> + union perf_event *event __maybe_unused,
> + struct ordered_events *oe)
> {
> if (dump_trace)
> fprintf(stdout, "\n");
> diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
> index 34500a3da735..be5871ea558f 100644
> --- a/tools/perf/util/session.h
> +++ b/tools/perf/util/session.h
> @@ -155,4 +155,8 @@ int perf_session__deliver_synth_event(struct perf_session *session,
> int perf_event__process_id_index(struct perf_session *session,
> union perf_event *event);
>
> +int perf_event__process_finished_round(struct perf_tool *tool,
> + union perf_event *event,
> + struct ordered_events *oe);
> +

Sorry to be naive, why is this perf_event__ and not perf_session__ ..
well I guess it is at least passed an event even though it doesn't use
it. Would be nice if there were comments, but this change is just
shifting things around. Anyway..

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

Thanks,
Ian

> #endif /* __PERF_SESSION_H */
> --
> 2.25.1
>