Re: [PATCH] perf dso: Fix dso comparison

From: Ravi Bangoria
Date: Tue Mar 24 2020 - 09:42:47 EST




On 3/24/20 6:52 PM, Jiri Olsa wrote:
On Tue, Mar 24, 2020 at 06:07:23PM +0530, Ravi Bangoria wrote:

SNIP

looks good, do we need to add the dso_id check to sort__dso_cmp?

I guess with different filename there is no need to compare dso_id.
But for same filename, adding dso_id cmp will separate out the
samples:

Ex, Without dso_id compare:

$ ./perf report -s dso,dso_size -v
66.63% /home/ravi/a.out 4096
33.36% /home/ravi/Workspace/linux/tools/perf/a.out 4096

$ ./perf report -s dso,dso_size
99.99% a.out 4096


With below diff:

- return strcmp(dso_name_l, dso_name_r);
+ ret = strcmp(dso_name_l, dso_name_r);
+ if (ret)
+ return ret;
+ else
+ return dso__cmp_id(dso_l, dso_r);


$ ./perf report -s dso,dso_size
99.99% a.out 4096
33.36% a.out 4096

though, the o/p also depends which other sort keys are used along
with dso key. Do you think this change makes sense?

the above behaviour is something I'd expect from 'dso'
sort key to do - separate out different dsos, even with
the same name

Yes it does that as well...

$ ./perf report -s dso
66.63% a.out
33.36% a.out

Ravi