Skip to content

Commit 0c0af78

Browse files
namhyungacmel
authored andcommitted
perf tools: Fix column width setting on 'trace' sort key
It missed to update column length of the 'trace' sort key in the hists__calc_col_len() so it might truncate the output. It calculated the column length in the ->cmp() callback originally but it doesn't guarantee it's called always. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1456064558-13086-5-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 2960ed6 commit 0c0af78

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎tools/perf/util/hist.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
179179
if (h->transaction)
180180
hists__new_col_len(hists, HISTC_TRANSACTION,
181181
hist_entry__transaction_len());
182+
183+
if (h->trace_output)
184+
hists__new_col_len(hists, HISTC_TRACE, strlen(h->trace_output));
182185
}
183186

184187
void hists__output_recalc_col_len(struct hists *hists, int max_rows)

‎tools/perf/util/sort.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,6 @@ sort__trace_cmp(struct hist_entry *left, struct hist_entry *right)
483483
if (right->trace_output == NULL)
484484
right->trace_output = get_trace_output(right);
485485

486-
hists__new_col_len(left->hists, HISTC_TRACE, strlen(left->trace_output));
487-
hists__new_col_len(right->hists, HISTC_TRACE, strlen(right->trace_output));
488-
489486
return strcmp(right->trace_output, left->trace_output);
490487
}
491488

0 commit comments

Comments
 (0)