Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1338937

[PATCH 5/5] perf tools: Fix column width setting on 'trace' sort key

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 5/5] perf tools: Fix column width setting on 'trace' sort key
Date 2016-02-21 19:30 +0100
Message-ID <r4GiU-12G-55@gated-at.bofh.it> (permalink)
References <r4FZw-Tg-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 tools/perf/util/hist.c | 3 +++
 tools/perf/util/sort.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 827c6cbcd05d..017eb5c42c37 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -179,6 +179,9 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 	if (h->transaction)
 		hists__new_col_len(hists, HISTC_TRANSACTION,
 				   hist_entry__transaction_len());
+
+	if (h->trace_output)
+		hists__new_col_len(hists, HISTC_TRACE, strlen(h->trace_output));
 }
 
 void hists__output_recalc_col_len(struct hists *hists, int max_rows)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 1d2b85c808d0..ea05497cfee9 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -501,9 +501,6 @@ sort__trace_cmp(struct hist_entry *left, struct hist_entry *right)
 	if (right->trace_output == NULL)
 		right->trace_output = get_trace_output(right);
 
-	hists__new_col_len(left->hists, HISTC_TRACE, strlen(left->trace_output));
-	hists__new_col_len(right->hists, HISTC_TRACE, strlen(right->trace_output));
-
 	return strcmp(right->trace_output, left->trace_output);
 }
 
-- 
2.7.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] perf tools: Fix assertion failure on dynamic entry Namhyung Kim <namhyung@kernel.org> - 2016-02-21 18:30 +0100
  Re: [PATCH 1/5] perf tools: Fix assertion failure on dynamic entry Jiri Olsa <jolsa@redhat.com> - 2016-02-21 18:40 +0100
    Re: [PATCH 1/5] perf tools: Fix assertion failure on dynamic entry Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-22 16:10 +0100
  Re: [PATCH 3/5] perf tools: Update srcline/file if needed Jiri Olsa <jolsa@redhat.com> - 2016-02-21 18:40 +0100
    [PATCH v2 3/5] perf tools: Update srcline/file if needed Namhyung Kim <namhyung@kernel.org> - 2016-02-22 01:40 +0100
      Re: [PATCH v2 3/5] perf tools: Update srcline/file if needed Jiri Olsa <jolsa@redhat.com> - 2016-02-22 07:50 +0100
  Re: [PATCH 2/5] perf tools: Fix segfault on dynamic entries Jiri Olsa <jolsa@redhat.com> - 2016-02-21 18:40 +0100
  Re: [PATCH 5/5] perf tools: Fix column width setting on 'trace' sort  key Jiri Olsa <jolsa@redhat.com> - 2016-02-21 18:50 +0100
  Re: [PATCH 4/5] perf tools: Fix alignment on some sort keys Jiri Olsa <jolsa@redhat.com> - 2016-02-21 18:50 +0100
    [PATCH v2 4/5] perf tools: Fix alignment on some sort keys Namhyung Kim <namhyung@kernel.org> - 2016-02-22 01:40 +0100
  [PATCH 2/5] perf tools: Fix segfault on dynamic entries Namhyung Kim <namhyung@kernel.org> - 2016-02-21 19:30 +0100
  [PATCH 4/5] perf tools: Fix alignment on some sort keys Namhyung Kim <namhyung@kernel.org> - 2016-02-21 19:30 +0100
  [PATCH 5/5] perf tools: Fix column width setting on 'trace' sort key Namhyung Kim <namhyung@kernel.org> - 2016-02-21 19:30 +0100
  [PATCH 3/5] perf tools: Update srcline/file if needed Namhyung Kim <namhyung@kernel.org> - 2016-02-21 19:40 +0100

csiph-web