diff options
author | 2025-04-30 13:55:40 -0700 | |
---|---|---|
committer | 2025-05-02 15:36:14 -0300 | |
commit | 29e6392ec38bbb61d677f71203caa87be1271ede (patch) | |
tree | 2045c8a144d0c012019ba088f9235a7de05c7f5c /tools/perf/util/sort.c | |
parent | perf record: Add --sample-mem-info option (diff) | |
download | wireguard-linux-29e6392ec38bbb61d677f71203caa87be1271ede.tar.xz wireguard-linux-29e6392ec38bbb61d677f71203caa87be1271ede.zip |
perf hist: Support multi-line header
This is a preparation to support multi-line headers in 'perf mem report'.
Normal sort keys and output fields that don't have contents for multi-
line will print the header string at the last line only.
As we don't use multi-line headers normally, it should not have any
changes in the output.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
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: Leo Yan <leo.yan@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20250430205548.789750-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/sort.c')
-rw-r--r-- | tools/perf/util/sort.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 594b75ca95bf..ae8b8ceb82f3 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -2641,18 +2641,22 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists) } static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, - struct hists *hists, int line __maybe_unused, + struct hists *hists, int line, int *span __maybe_unused) { struct hpp_sort_entry *hse; size_t len = fmt->user_len; + const char *hdr = ""; + + if (line == hists->hpp_list->nr_header_lines - 1) + hdr = fmt->name; hse = container_of(fmt, struct hpp_sort_entry, hpp); if (!len) len = hists__col_len(hists, hse->se->se_width_idx); - return scnprintf(hpp->buf, hpp->size, "%-*.*s", len, len, fmt->name); + return scnprintf(hpp->buf, hpp->size, "%-*.*s", len, len, hdr); } static int __sort__hpp_width(struct perf_hpp_fmt *fmt, |