]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf mem: Display sort order only if it's available
authorNamhyung Kim <namhyung@kernel.org>
Fri, 23 May 2025 22:21:56 +0000 (15:21 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 28 May 2025 17:41:42 +0000 (14:41 -0300)
IOW it's not used when -F option is used alone.  Let's make it
conditional to skip printing incorrect information.

Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20250523222157.1259998-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c

index f0299c7ee0254a371e45c721b7b3638843f55ac1..e662e1c3a7c6b6ec139d921c7d16a93ef4a7db2b 100644 (file)
@@ -529,7 +529,10 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
 
        if (rep->mem_mode) {
                ret += fprintf(fp, "\n# Total weight : %" PRIu64, nr_events);
-               ret += fprintf(fp, "\n# Sort order   : %s", sort_order ? : default_mem_sort_order);
+               if (sort_order || !field_order) {
+                       ret += fprintf(fp, "\n# Sort order   : %s",
+                                      sort_order ? : default_mem_sort_order);
+               }
        } else
                ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);