Commit 7a6710d0 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf mem: Display sort order only if it's available



IOW it's not used when -F option is used alone.  Let's make it
conditional to skip printing incorrect information.

Reviewed-by: default avatarLeo Yan <leo.yan@arm.com>
Signed-off-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 00a23c00
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);