From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754997AbcITVng (ORCPT ); Tue, 20 Sep 2016 17:43:36 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39186 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754720AbcITVne (ORCPT ); Tue, 20 Sep 2016 17:43:34 -0400 Date: Tue, 20 Sep 2016 14:43:20 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: dzickus@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, jolsa@kernel.org, tglx@linutronix.de, acme@redhat.com, jmario@redhat.com, dsahern@gmail.com, andi@firstfloor.org, namhyung@kernel.org, a.p.zijlstra@chello.nl, mingo@kernel.org Reply-To: jmario@redhat.com, dsahern@gmail.com, andi@firstfloor.org, namhyung@kernel.org, a.p.zijlstra@chello.nl, mingo@kernel.org, dzickus@redhat.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, acme@redhat.com In-Reply-To: <1474290610-23241-62-git-send-email-jolsa@kernel.org> References: <1474290610-23241-62-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf hists: Fix width computation for srcline sort entry Git-Commit-ID: f666ac0dab5afaf6ebed2c361251581bfccc4003 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f666ac0dab5afaf6ebed2c361251581bfccc4003 Gitweb: http://git.kernel.org/tip/f666ac0dab5afaf6ebed2c361251581bfccc4003 Author: Jiri Olsa AuthorDate: Mon, 19 Sep 2016 15:10:10 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 20 Sep 2016 12:28:28 -0300 perf hists: Fix width computation for srcline sort entry Adding header size to width computation for srcline sort entry, because it's possible to get empty data with ':0' which set width of 2 which is lower than width needed to display column header. Signed-off-by: Jiri Olsa Cc: Andi Kleen Cc: David Ahern Cc: Don Zickus Cc: Joe Mario Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1474290610-23241-62-git-send-email-jolsa@kernel.org [ Added declaration to sort.h ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 6 ++++-- tools/perf/util/sort.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 37a08f2..b02992e 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -177,8 +177,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); - if (h->srcline) - hists__new_col_len(hists, HISTC_SRCLINE, strlen(h->srcline)); + if (h->srcline) { + len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header)); + hists__new_col_len(hists, HISTC_SRCLINE, len); + } if (h->srcfile) hists__new_col_len(hists, HISTC_SRCFILE, strlen(h->srcfile)); diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 28c0524..9505483 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h @@ -40,6 +40,7 @@ extern struct sort_entry sort_dso_from; extern struct sort_entry sort_dso_to; extern struct sort_entry sort_sym_from; extern struct sort_entry sort_sym_to; +extern struct sort_entry sort_srcline; extern enum sort_type sort__first_dimension; extern const char default_mem_sort_order[];