Re: [PATCH v2 2/2] perf hists browser: Consolidate callchain print functions in TUI

From: Ingo Molnar
Date: Fri Aug 22 2014 - 04:02:50 EST



* Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:

> Em Thu, Aug 21, 2014 at 10:15:46AM +0900, Namhyung Kim escreveu:
> > Currently there're two callchain print functions in TUI - one for the
> > hists browser and another for file dump. They do almost same job so
> > it'd be better consolidate the codes.
>
> Some comments below, thanks for doing this work!
>
> > To do that, move row calculation code into a print callback so that
> > the dump code cannot be limited by the current screen size.
>
> > Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > ---
> > tools/perf/ui/browsers/hists.c | 210 +++++++++++++++--------------------------
> > 1 file changed, 76 insertions(+), 134 deletions(-)
> >
> > diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> > index 519353d9f5fb..48d8c8eee6c2 100644
> > --- a/tools/perf/ui/browsers/hists.c
> > +++ b/tools/perf/ui/browsers/hists.c
> > @@ -477,20 +477,32 @@ static char *callchain_list__sym_name(struct callchain_list *cl,
> > return bf;
> > }
> >
> > +struct callchain_print_arg {
> > + /* for hists browser */
> > + unsigned short row;
> > + off_t row_offset;
> > + bool is_current_entry;
> > +
> > + /* for file dump */
> > + FILE *fp;
> > + int printed;
> > +};

Just a data type definition nitpicking pet peeve of mine, don't
you guys too find this vertically aligned form infinitely more
readable:

struct callchain_print_arg {
/* for hists browser */
unsigned short row;
off_t row_offset;
bool is_current_entry;

/* for file dump */
FILE *fp;
int printed;
};

especially when looking at it via email, without syntax
highlighting?

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/