Re: [PATCH v5 23/23] perf sort: Use perf_env to set arch sort keys and header

From: Namhyung Kim
Date: Tue Jul 01 2025 - 02:24:05 EST


On Fri, Jun 27, 2025 at 09:50:17PM -0700, Ian Rogers wrote:
> Previously arch_support_sort_key and arch_perf_header_entry used a
> weak symbol to compile as appropriate for x86 and powerpc. A
> limitation to this is that the handling of a data file could vary in
> cross-platform development. Change to using the perf_env of the
> current session to determine the architecture kind and set the sort
> key and header entries as appropriate.
>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> ---
[SNIP]
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index ada8e0166c78..6f24540bdee9 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -1790,7 +1790,7 @@ int cmd_report(int argc, const char **argv)
> }
>
> if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&
> - (setup_sorting(session->evlist) < 0)) {
> + (setup_sorting(session->evlist, &session->header.env) < 0)) {

perf_session__env(session) ?

Thanks,
Namhyung


> if (sort_order)
> parse_options_usage(report_usage, options, "s", 1);
> if (field_order)