Re: [PATCH 1/1 tip] perf report: Adjust column width to the valuessampled

From: Ingo Molnar
Date: Fri Jul 10 2009 - 00:01:26 EST



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

> Example:
>
> [acme@doppio pahole]$ perf report --sort comm,dso,symbol | head -13
>
> 12.79% pahole /usr/lib64/libdw-0.141.so [.] __libdw_find_attr
> 8.90% pahole /lib64/libc-2.10.1.so [.] _int_malloc
> 8.68% pahole /usr/lib64/libdw-0.141.so [.] __libdw_form_val_len
> 8.15% pahole /lib64/libc-2.10.1.so [.] __GI_strcmp
> 6.80% pahole /lib64/libc-2.10.1.so [.] __tsearch
> 5.54% pahole ./build/libdwarves.so.1.0.0 [.] tag__recode_dwarf_type
> [acme@doppio pahole]$
>
> [acme@doppio pahole]$ perf report --sort comm,dso,symbol -d /lib64/libc-2.10.1.so | head -10
>
> 21.92% pahole /lib64/libc-2.10.1.so [.] _int_malloc
> 20.08% pahole /lib64/libc-2.10.1.so [.] __GI_strcmp
> 16.75% pahole /lib64/libc-2.10.1.so [.] __tsearch
> [acme@doppio pahole]$
>
> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Mike Galbraith <efault@xxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxx>
> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> Suggested-by: Ingo Molnar <mingo@xxxxxxx>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> ---
> tools/perf/builtin-report.c | 93 ++++++++++++++++++++++++--------
> tools/perf/util/include/linux/kernel.h | 8 +++
> tools/perf/util/symbol.c | 1 +
> tools/perf/util/symbol.h | 1 +
> 4 files changed, 80 insertions(+), 23 deletions(-)

Ok, that's certainly a nice feature.

The only worry is that this makes it harder to post-process the
output via scripts. Mind eliminating this worry and completing this
patch by adding two other variants of this as well:

-w, --field-width=<COLS>

Force column width to <COLS>, for large terminal readability.

( Optional: perhaps also allow for special syntax -w 10,20,10 for
separate width for separate columns. )

-t, --field-separator=<SEP>

Use special separator character <SEP> and dont pad with spaces,
and replace all occurances of '<SEP>' in symbol names (and other
output) with a '.' character.

This is for easier output parsing for scripts.

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/