Skip to content

Commit 036e2fa

Browse files
dvyukovnamhyung
authored andcommitted
perf hist: Fix width calculation in hpp__fmt()
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>
1 parent 8b4799e commit 036e2fa

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)