Re: [RFC/PATCHSET 00/14] perf report: Add support to accumulate hist periods (v2)

Namhyung Kim
2013-11-06T07:56:17Z

Hi Ingo,

On Tue, 5 Nov 2013 12:58:02 +0100, Ingo Molnar wrote:
> * Namhyung Kim <namhyung@kernel.org> wrote:
>> But the 'cumulative' (btw, I feel a bit hard to type this word..) is
>> different in that it *generates* entries didn't get sampled originally.
>> And as it requires callchains, total field will not work if callchains
>> are missing.
>
> Well, 'total' should disappear if it's not available.

But what if it's the only sort key user gave?

>
> We already have some 'column elimination/optimization' logic - like the
> 'dso' will disappear already if it's a single dso everywhere, IIRC?

When user explicitly gives a single name as the column filter with -c,
-d and/or -S options.

But it seems to have a same issue that I said above:

$ perf report -s comm -c perf --stdio
(...)
# Overhead
# ........
#
100.00%

And TUI even shows a noise in the output.

>
>> But as Frederic noted, it might affect the performance of perf report,
>> so it might be better to delay this behavior to make default after users
>> feel comfortable with an option?
>
> I think with call-chain speedups it should be fast enough, right?

Yeah, it should speedup things significantly.

>
> We can argue about the default separately - if it's all done correctly
> then it should be really easy to change the default layout of 'perf
> report'.
>

I just think that the perf tools are going so fast. ;-)

>> For now, there're two kind of columns:
>>
>> - one for showing entry's overhead percentage: self, sys, user,
>> guest_sys and guest_user. So the 'total' should go into this
>> category. I named it hpp (hist_entry period percentage) functions and
>> yes, I know it's an awfully bad name. :) Please see perf_hpp__format.
>>
>> There're controlled by a couple of options: --show-total-period,
>> --show-nr-samples and --showcpuutilization (I hate this!). And event
>> group also can affect its output.
>>
>> - one for grouping entries: cpu, pid, comm, dso, symbol, srcline and
>> parent. We call it "sort keys" but confusingly it doesn't affect
>> output sorting for now.
>
> Well, it's still a sort key in a sense, a string lexicographical ordering
> in essence, right?

Right. But it only affects on groupping entries when added and
collapsed not the output ordering.

>
>> > If there's demand then we could decouple sort keys from the display
>> > order, by slightly augmenting the field format:
>> >
>> > -F total,self:2,process:0,dso:1,name
>> >
>> > This would sort by 'process' field as the primary key, 'dso' the secondary
>> > key and 'self' as the tertiary key.
>> >
>> > And we could also keep the -s/--sort option:
>> >
>> > -s process,dso,self
>> >
>> > So the above -F line would be equivalent to:
>> >
>> > -F total,self,process,dso,name -s process,dso,self
>> >
>> > What do you think?
>>
>> I like the second one. It can sustain the old way but can support the
>> new way easily.
>>
>> But for compatibility we need to use 'self' sort key internally iff
>> neither the -F option nor the config option was given by user. And it
>> might warn (or notice) users to add 'self' column in the sort key for
>> future use.
>
> Mind explaining what the problem here is? I don't think I get it.

Well, normal users still use it as they used to - like
'perf report -s comm,dso' without -F option and the config.

In that case, what would the output look like? According to the above
proposal it'd look like below.

# Command Shared object
# ....... .............
aaa aaa
aaa libc.so
bbb bbb
bbb libc.so

But the user might want see this:

# Overhead (self) Command Shared object
# ............... ....... .............
30.00% bbb bbb
25.00% aaa aaa
25.00% aaa libc.so
20.00% bbb libc.so

If she really wants to see it sorted by comm and dso, the command line
should be 'perf report -F self,comm,dso -s comm,dso'
(or just 'perf report -F self -s comm,dso' could do the same).

# Overhead (self) Command Shared object
# ............... ....... .............
25.00% aaa aaa
25.00% aaa libc.so
30.00% bbb bbb
20.00% bbb libc.so

Thanks,
Namhyung