Skip to content

Commit f545902

Browse files
committed
perf hist: Fix width calculation in hpp__fmt()
JIRA: https://issues.redhat.com/browse/RHEL-77936 upstream ======== commit 036e2fa Author: Dmitry Vyukov <dvyukov@google.com> Date: Wed Jan 8 07:59:34 2025 +0100 description =========== hpp__width_fn() round up width to length of the field name, hpp__fmt() should do it too. Otherwise, the numbers may end up unaligned if the field name is long. Signed-off-by: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: James Clark <james.clark@linaro.org> Link: https://lore.kernel.org/r/20250108065949.235718-1-dvyukov@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent 7adcd00 commit f545902

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/ui/hist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ int hpp__fmt(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
121121
const char *fmtstr, hpp_snprint_fn print_fn,
122122
enum perf_hpp_fmt_type fmtype)
123123
{
124-
int len = fmt->user_len ?: fmt->len;
124+
int len = max(fmt->user_len ?: fmt->len, (int)strlen(fmt->name));
125125

126126
if (symbol_conf.field_sep) {
127127
return __hpp__fmt(hpp, he, get_field, fmtstr, 1,

0 commit comments

Comments
 (0)