Re: [RFC] perf/core: what is exclude_idle supposed to do
From: Stephane Eranian
Date: Fri Apr 20 2018 - 14:19:33 EST
On Fri, Apr 20, 2018 at 9:51 AM Vince Weaver <vincent.weaver@xxxxxxxxx>
wrote:
> On Fri, 20 Apr 2018, Vince Weaver wrote:
> > > AFAICT it works on Power and possibly ARM.
> >
> > at least some ARMs are a bit more honest about it than x86
> >
> > ivybridge:
> > Performance counter stats for '/bin/ls':
> > 1,368,162 instructions
> > 1,368,162 instructions:I
> >
> > pi2/ARM cortex-A7
> > Performance counter stats for '/bin/ls':
> > 1,910,083 instructions
> > <not supported> instructions:I
> >
> > I'd fire up my Power8 machine to see but not sure it's worth the hassle
> > and/or having to get out the ear protection.
> I did power up the Power8 machine in the end:
> power8:
> perf stat -e cycles,cycles:I sleep 5
> Performance counter stats for 'sleep 5':
> 14,271,273 cycles
> 14,271,273 cycles:I
> ???
> But then if I try again on power8
> perf stat -a -e cycles,cycles:I sleep 5
> Performance counter stats for 'system wide':
> 1,238,772,322,327 cycles
> 1,238,674,771,713 cycles:I
> there is a difference.
> But then on ivybridge
> perf stat -a -e cycles,cycles:I sleep 5
> Performance counter stats for 'system wide':
> 589,598,104 cycles
> 589,537,190 cycles:I
This may be noise.
The way the flag is named leads me to believe its goal is to not count when
executing in the context of the idle task (pid 0 on each CPU).
However, it does not seem to be implemented that way. If you were to
implement this, then in system wide mode you'd have to check
the incoming task on ctxsw, very much like we do in cgroup monitoring. So
it would not be totally free. One can argue, in sampling mode
you can eliminate the samples coming from PID=0 in the tool. But there
would be nothing to cover counting mode.
Interestingly, there is also code in perf tool to exclude known idle
routines from reporting. But this is targeted to only some routines that the
idle task may end up executing. so it is not quite the same.
> So maybe exclude_idle does do something on x86? Or am I completely
> misunderstanding what the flag is supposed to be indicating?
> Vince