lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ch56Otv0T-AxL9yyDhhvyHdHtAw+Q=ZwDLyH0kvjE5-Yw@mail.gmail.com>
Date:	Fri, 25 Jul 2014 00:51:56 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/6] perf report: Honor column width setting

On Thu, Jul 24, 2014 at 9:47 PM, Jiri Olsa <jolsa@...hat.com> wrote:
> 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
>
>>
>>  static inline void advance_hpp(struct perf_hpp *hpp, int inc)
>>  {
>> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
>> index 396b0094943d..f89714329c0f 100644
>> --- 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);
>
> I couldn't found what your format string:
>   "%-*.*s:%5d", width, width
>
> is supposed to do... it gives me the same result as for:
>   "%-*s:%5d", width
>
> you use it on more places so I guess it's not a typo ;-)

Yep, it's NOT a typo.  The second * is necessary for limiting maximum
length of printed string - without it we cannot control column
alignment of long symbols.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ