From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759726AbcBTXTV (ORCPT ); Sat, 20 Feb 2016 18:19:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37246 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759647AbcBTXTP (ORCPT ); Sat, 20 Feb 2016 18:19:15 -0500 Date: Sun, 21 Feb 2016 00:19:08 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Andi Kleen , Stephane Eranian , Wang Nan Subject: Re: [PATCH v6 20/25] perf hists browser: Implement hierarchy output Message-ID: <20160220231908.GC17925@krava.homerouter.cpe> References: <1455631723-17345-1-git-send-email-namhyung@kernel.org> <1455631723-17345-21-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455631723-17345-21-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]); Sat, 20 Feb 2016 23:19:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2016 at 11:08:38PM +0900, Namhyung Kim wrote: > Implement hierarchy mode in TUI. The output is look like stdio but it > also supports to fold/unfold children dynamically. > > Acked-by: Pekka Enberg > Signed-off-by: Namhyung Kim > --- > tools/perf/ui/browsers/hists.c | 269 +++++++++++++++++++++++++++++++++++++---- > 1 file changed, 247 insertions(+), 22 deletions(-) > > diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c > index 857b9beb0aab..d209cf07bd12 100644 > --- a/tools/perf/ui/browsers/hists.c > +++ b/tools/perf/ui/browsers/hists.c > @@ -1260,6 +1260,137 @@ static int hist_browser__show_entry(struct hist_browser *browser, > return printed; > } > > +static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, > + struct hist_entry *entry, > + unsigned short row, > + int level, int nr_sort_keys) > +{ SNIP > + > + hists__for_each_format(entry->hists, fmt) { > + if (perf_hpp__should_skip(fmt, entry->hists) || > + column++ < browser->b.horiz_scroll) > + continue; > + > + if (perf_hpp__is_sort_entry(fmt) || > + perf_hpp__is_dynamic_entry(fmt)) > + break; > + > + if (current_entry && browser->b.navkeypressed) { > + ui_browser__set_color(&browser->b, > + HE_COLORSET_SELECTED); > + } else { > + ui_browser__set_color(&browser->b, > + HE_COLORSET_NORMAL); > + } > + > + if (first) { > + ui_browser__printf(&browser->b, "%c", folded_sign); > + width--; > + first = false; > + } else { > + ui_browser__printf(&browser->b, " "); > + width -= 2; > + } > + > + if (fmt->color) { > + width -= fmt->color(fmt, &hpp, entry); > + } else { > + width -= fmt->entry(fmt, &hpp, entry); > + ui_browser__printf(&browser->b, "%s", s); > + } same as for stdio patch comment, you might want to use hist_entry__snprintf_alignment in here jirka