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]
Date:   Sat, 25 Feb 2017 13:06:28 +0000
From:   Charles Baylis <charles.baylis@...aro.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     peterz@...radead.org, mingo@...hat.com,
        alexander.shishkin@...ux.intel.com, linux-kernel@...r.kernel.org,
        Maxim Kuvyrkov <maxim.kuvyrkov@...aro.org>
Subject: Re: [PATCH] perf report: Allow sorting by symbol size.

On 24 February 2017 at 19:22, Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
>>
>> +/* --sort symbol_size */
>> +
>> +static int64_t _sort__sym_size_cmp(struct symbol *sym_l, struct symbol *sym_r)
>> +{
>> +     int64_t size_l = sym_l != NULL ? sym_l->end - sym_l->start : 0;
>> +     int64_t size_r = sym_r != NULL ? sym_r->end - sym_r->start : 0;
>
> We have symbol__size(), no need to open code it, I'll fix it

OK thanks.

>> +
>> +     return size_l < size_r ? -1 :
>> +             size_l == size_r ? 0 : 1;
>> +}
>> +
>> +static int64_t
>> +sort__sym_size_cmp(struct hist_entry *left, struct hist_entry *right)
>> +{
>> +     return _sort__sym_size_cmp(right->ms.sym, left->ms.sym);
>> +}
>> +
>> +static int _hist_entry__sym_size_snprintf(struct symbol *sym, char *bf,
>> +                                       size_t bf_size, unsigned int width)
>> +{
>> +     if (sym) {
>> +             int64_t sym_size = sym->end - sym->start;
>
>
> Ditto
>
>> +
>> +             return repsep_snprintf(bf, bf_size, "%*lld", width,
>> +                                     (long long)sym_size);
>
> Humm, why use lld instead of plain d, that way you can get rid of that
> (long long)? I'm fixing this as well

struct symbol defines start and end as u64, so it seemed prudent to
treat the size as 64 bit too. However, since symbol__size() returns
size_t, the best thing to write is probably

    return repsep_snprintf(bf, bf_size, "%*zu", width, symbol__size(sym));

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ