Re: [PATCH 5/7] perf ui/stdio: Reset output width for hierarchy

From: Namhyung Kim
Date: Mon Sep 12 2016 - 21:00:58 EST


On Mon, Sep 12, 2016 at 11:27:28AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Sep 12, 2016 at 03:19:56PM +0900, Namhyung Kim escreveu:
> > When --hierarchy option is used, each entry has its own hpp_list to show
> > the result. But it missed to update width of each column.
>
> Missing "Fixes:" tag? This is important for the stable series, that IIRC
> uses those tags to semi-automatically figure out what should be picked.

Looking at the code again, it already reset the width in the
hists__fprintf_hiearachy_headers(). But it's only called when the
show_header is true, so perf-top broke alignment.


$ sudo perf top --hierarchy --stdio

PerfTop: 160 irqs/sec kernel:38.8% exact: 100.0% [4000Hz cycles:pp], (all, 12 CPUs)
-------------------------------------------------------------------------------------------

52.32% perf
24.74% [.] __symbols__insert
5.62% [.] rb_next
5.14% [.] dso__load_sym

It's from the commit 1b2dbbf41a0f ("perf hists: Use own hpp_list for
hierarchy mode"). I'll fix the code and add the "Fixes:" tag in v2.

Thanks,
Namhyung


> > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > ---
> > tools/perf/ui/stdio/hist.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> > index 9b65f4a6b35a..83ca728b6f61 100644
> > --- a/tools/perf/ui/stdio/hist.c
> > +++ b/tools/perf/ui/stdio/hist.c
> > @@ -733,6 +733,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
> > 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;
> > @@ -745,6 +746,11 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
> >
> > 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);
> > + }
> >
> > if (symbol_conf.col_width_list_str)
> > perf_hpp__set_user_width(symbol_conf.col_width_list_str);
> > --
> > 2.9.3