Re: [PATCH 4/6] perf report: Honor column width setting

From: Namhyung Kim
Date: Thu Jul 24 2014 - 11:41:39 EST


Hi guys,

On Thu, Jul 24, 2014 at 11:49 PM, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> On Thu, Jul 24, 2014 at 10:57:47AM -0300, Arnaldo Carvalho de Melo wrote:
>> Em Thu, Jul 24, 2014 at 02:57:51PM +0200, Jiri Olsa escreveu:
>> > On Wed, Jul 09, 2014 at 02:28:12PM +0900, Namhyung Kim wrote:
>> > > Set column width and do not change it if user gives -w/--column-widths
>> > > option. It'll truncate longer symbols than the width if exists.
>> >
>> > SNIP
>> >
>> > > --- a/tools/perf/util/sort.c
>> > > +++ b/tools/perf/util/sort.c
>> > > @@ -70,7 +70,9 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
>> > > size_t size, unsigned int width)
>> > > {
>> > > const char *comm = thread__comm_str(he->thread);
>> > > - return repsep_snprintf(bf, size, "%-*s:%5d", width - 6,
>> > > +
>> > > + width = max(7U, width) - 6;
>> > > + return repsep_snprintf(bf, size, "%-*.*s:%5d", width, width,
>> > > comm ?: "", he->thread->tid);
>> > > }
>> >
>> > also we now print out all sort headers left alligned, which is wrong for
>> > sort_thread header: "Command: Pid' that mirrors value strings with ':'
>> > being aligned
>> >
>> > maybe something like in attached patch..?
>> >
>> > thanks,
>> > jirka
>> >
>> >
>> > ---
>> > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
>> > index f89714329c0f..fbbe86b7f63c 100644
>> > --- a/tools/perf/util/sort.c
>> > +++ b/tools/perf/util/sort.c
>> > @@ -78,6 +78,7 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
>> >
>> > struct sort_entry sort_thread = {
>> > .se_header = "Command: Pid",
>> > + .se_header_right= true,
>>
>> Is this just for the header? Perhaps its more clearly named .se_right_justify?
>
> yep, it's just for header.. let's see Namhyung might have better
> idea how to handle this problem

I think it still needs to be left-aligned. So I'd rather change the
order - i.e. "Pid: Command". Is it okay for you?

Thanks,
Namhyung
--
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/