From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752079AbcBJOds (ORCPT ); Wed, 10 Feb 2016 09:33:48 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35919 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751556AbcBJOdo (ORCPT ); Wed, 10 Feb 2016 09:33:44 -0500 Date: Wed, 10 Feb 2016 23:32:32 +0900 From: Namhyung Kim To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Andi Kleen , Stephane Eranian , Wang Nan Subject: Re: [PATCH 15/23] perf ui/stdio: Align column header for hierarchy output Message-ID: <20160210143232.GE4301@danjae.kornet> References: <1454677315-7515-1-git-send-email-namhyung@kernel.org> <1454677315-7515-16-git-send-email-namhyung@kernel.org> <20160210124003.GA15487@krava.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160210124003.GA15487@krava.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2016 at 01:40:03PM +0100, Jiri Olsa wrote: > On Fri, Feb 05, 2016 at 10:01:47PM +0900, Namhyung Kim wrote: > > The hierarchy output mode is to group entries so the existing columns > > won't fit to the new output. Treat all sort keys as a single column and > > separate headers by "/". > > > > # Overhead Command / Shared Object > > # ........... ................................ > > # > > 15.11% swapper > > 14.97% [kernel.vmlinux] > > 0.09% [libahci] > > 0.05% [iwlwifi] > > ... > > > > Acked-by: Pekka Enberg > > Signed-off-by: Namhyung Kim > > --- > > tools/perf/ui/stdio/hist.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 107 insertions(+) > > > > diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c > > index b58f718a6afc..4bdab3cf1b6c 100644 > > --- a/tools/perf/ui/stdio/hist.c > > +++ b/tools/perf/ui/stdio/hist.c > > @@ -505,6 +505,108 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, > > return ret; > > } > > > > +static int print_hierarchy_indent(const char *sep, int nr_sort, > > + const char *line, FILE *fp) > > +{ > > + if (sep != NULL || nr_sort < 1) > > + return 0; > > + > > + return fprintf(fp, "%-.*s", (nr_sort - 1) * HIERARCHY_INDENT, line); > > hum, could you use fprintf(fp, "%*c", nr_sort..., '.'); > > with the same effect to get rid of those dots and spaces strings.. Is it possible? I already tried but it failed with the dots.. $ cat dot.c #include int main(void) { printf("%*c\n", 5, '.'); return 0; } $ gcc dot.c $ ./a.out . $ Thanks, Namhyung