From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753294AbcBURnA (ORCPT ); Sun, 21 Feb 2016 12:43:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55367 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752213AbcBURmA (ORCPT ); Sun, 21 Feb 2016 12:42:00 -0500 Date: Sun, 21 Feb 2016 18:41:55 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Andi Kleen Subject: Re: [PATCH 5/5] perf tools: Fix column width setting on 'trace' sort key Message-ID: <20160221174155.GJ10701@krava.homerouter.cpe> References: <1456064558-13086-1-git-send-email-namhyung@kernel.org> <1456064558-13086-5-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456064558-13086-5-git-send-email-namhyung@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 21 Feb 2016 17:42:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 21, 2016 at 11:22:38PM +0900, Namhyung Kim wrote: > 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. Acked-by: Jiri Olsa thanks, jirka > > Signed-off-by: Namhyung Kim > --- > 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 >