From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932558AbcCJVG6 (ORCPT ); Thu, 10 Mar 2016 16:06:58 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:42790 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932335AbcCJVFG (ORCPT ); Thu, 10 Mar 2016 16:05:06 -0500 From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Namhyung Kim , Andi Kleen , David Ahern , Peter Zijlstra , Stephane Eranian , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 11/19] perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() Date: Thu, 10 Mar 2016 18:04:32 -0300 Message-Id: <1457643880-4908-12-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457643880-4908-1-git-send-email-acme@kernel.org> References: <1457643880-4908-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namhyung Kim The hist_browser__fprintf_hierarchy_entry() if to dump current output into a file so it needs to be sync-ed with the corresponding function hist_browser__show_hierarchy_entry(). So use hists->nr_hpp_node to indent width and use first fmt_node to print overhead columns instead of checking whether it's a sort entry (or dynamic entry). Signed-off-by: Namhyung Kim Tested-by: Jiri Olsa Cc: Andi Kleen Cc: David Ahern Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Wang Nan Link: http://lkml.kernel.org/r/1457531222-18130-6-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/hists.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index e0e217ec856b..aed9c8f011f7 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -1928,8 +1928,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser, static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser, struct hist_entry *he, - FILE *fp, int level, - int nr_sort_keys) + FILE *fp, int level) { char s[8192]; int printed = 0; @@ -1939,23 +1938,20 @@ static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser, .size = sizeof(s), }; struct perf_hpp_fmt *fmt; + struct perf_hpp_list_node *fmt_node; bool first = true; int ret; - int hierarchy_indent = nr_sort_keys * HIERARCHY_INDENT; + int hierarchy_indent = (he->hists->nr_hpp_node - 2) * HIERARCHY_INDENT; printed = fprintf(fp, "%*s", level * HIERARCHY_INDENT, ""); folded_sign = hist_entry__folded(he); printed += fprintf(fp, "%c", folded_sign); - hists__for_each_format(he->hists, fmt) { - if (perf_hpp__should_skip(fmt, he->hists)) - continue; - - if (perf_hpp__is_sort_entry(fmt) || - perf_hpp__is_dynamic_entry(fmt)) - break; - + /* the first hpp_list_node is for overhead columns */ + fmt_node = list_first_entry(&he->hists->hpp_formats, + struct perf_hpp_list_node, list); + perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { if (!first) { ret = scnprintf(hpp.buf, hpp.size, " "); advance_hpp(&hpp, ret); @@ -1992,7 +1988,6 @@ static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries), browser->min_pcnt); int printed = 0; - int nr_sort = browser->hists->nr_sort_keys; while (nd) { struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); @@ -2000,8 +1995,7 @@ static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) if (symbol_conf.report_hierarchy) { printed += hist_browser__fprintf_hierarchy_entry(browser, h, fp, - h->depth, - nr_sort); + h->depth); } else { printed += hist_browser__fprintf_entry(browser, h, fp); } -- 2.5.0