From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755315AbcITVqK (ORCPT ); Tue, 20 Sep 2016 17:46:10 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39374 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754804AbcITVqH (ORCPT ); Tue, 20 Sep 2016 17:46:07 -0400 Date: Tue, 20 Sep 2016 14:45:28 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: tglx@linutronix.de, peterz@infradead.org, acme@redhat.com, hpa@zytor.com, andi@firstfloor.org, jolsa@redhat.com, mingo@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org Reply-To: tglx@linutronix.de, peterz@infradead.org, andi@firstfloor.org, jolsa@redhat.com, acme@redhat.com, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org In-Reply-To: <20160920053025.13989-2-namhyung@kernel.org> References: <20160920053025.13989-2-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf hists: Factor out hists__reset_column_width() Git-Commit-ID: e3b60bc93d81e0542ac433df226b8de8b963533e 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: e3b60bc93d81e0542ac433df226b8de8b963533e Gitweb: http://git.kernel.org/tip/e3b60bc93d81e0542ac433df226b8de8b963533e Author: Namhyung Kim AuthorDate: Tue, 20 Sep 2016 14:30:24 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 20 Sep 2016 16:13:37 -0300 perf hists: Factor out hists__reset_column_width() The stdio and tui has same code to reset hpp format column width. Factor it out as a new function. Suggested-and-Acked-by: Jiri Olsa Signed-off-by: Namhyung Kim Cc: Andi Kleen Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20160920053025.13989-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/hists.c | 12 +++--------- tools/perf/ui/hist.c | 15 +++++++++++++++ tools/perf/ui/stdio/hist.c | 10 +--------- tools/perf/util/hist.h | 1 + 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 49db163..a6d5d24 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -2067,7 +2067,6 @@ void hist_browser__init(struct hist_browser *browser, struct hists *hists) { struct perf_hpp_fmt *fmt; - struct perf_hpp_list_node *node; browser->hists = hists; browser->b.refresh = hist_browser__refresh; @@ -2076,15 +2075,10 @@ void hist_browser__init(struct hist_browser *browser, browser->b.use_navkeypressed = true; browser->show_headers = symbol_conf.show_hist_headers; - hists__for_each_format(hists, fmt) { - perf_hpp__reset_width(fmt, hists); + hists__for_each_format(hists, fmt) ++browser->b.columns; - } - /* hierarchy entries have their own hpp list */ - list_for_each_entry(node, &hists->hpp_formats, list) { - perf_hpp_list__for_each_format(&node->hpp, fmt) - perf_hpp__reset_width(fmt, hists); - } + + hists__reset_column_width(hists); } struct hist_browser *hist_browser__new(struct hists *hists) diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index b47fafc..60c4a4d 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -699,6 +699,21 @@ void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists) } } +void hists__reset_column_width(struct hists *hists) +{ + struct perf_hpp_fmt *fmt; + struct perf_hpp_list_node *node; + + hists__for_each_format(hists, fmt) + perf_hpp__reset_width(fmt, hists); + + /* hierarchy entries have their own hpp list */ + list_for_each_entry(node, &hists->hpp_formats, list) { + perf_hpp_list__for_each_format(&node->hpp, fmt) + perf_hpp__reset_width(fmt, hists); + } +} + void perf_hpp__set_user_width(const char *width_list_str) { struct perf_hpp_fmt *fmt; diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index a57131e..8e1840b 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c @@ -717,8 +717,6 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, int max_cols, float min_pcnt, FILE *fp, bool use_callchain) { - struct perf_hpp_fmt *fmt; - struct perf_hpp_list_node *node; struct rb_node *nd; size_t ret = 0; const char *sep = symbol_conf.field_sep; @@ -729,13 +727,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, init_rem_hits(); - hists__for_each_format(hists, fmt) - perf_hpp__reset_width(fmt, hists); - /* hierarchy entries have their own hpp list */ - list_for_each_entry(node, &hists->hpp_formats, list) { - perf_hpp_list__for_each_format(&node->hpp, fmt) - perf_hpp__reset_width(fmt, hists); - } + hists__reset_column_width(hists); if (symbol_conf.col_width_list_str) perf_hpp__set_user_width(symbol_conf.col_width_list_str); diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index a002c93..defa957 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -368,6 +368,7 @@ static inline bool perf_hpp__should_skip(struct perf_hpp_fmt *format, void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists); void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists); void perf_hpp__set_user_width(const char *width_list_str); +void hists__reset_column_width(struct hists *hists); typedef u64 (*hpp_field_fn)(struct hist_entry *he); typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front);