Re: [RFC] perf/core: what is exclude_idle supposed to do

From: Jiri Olsa
Date: Tue Apr 17 2018 - 02:20:19 EST


On Mon, Apr 16, 2018 at 10:04:53PM +0000, Stephane Eranian wrote:
> Hi,
>
> I am trying to understand what the exclude_idle event attribute is supposed
> to accomplish.
> As per the definition in the header file:
>
> exclude_idle : 1, /* don't count when idle */
>
> Naively, I thought it would simply stop the event when running in the
> context of the idle task (swapper, pid 0) on any CPU. That would seem to
> match the succinct description.
>
> However, running a simple:
>
> $ perf record -a -e cycles:I sleep 5
> perf_event_attr:
> sample_type IP|TID|TIME|CPU|PERIOD
> read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID
> exclude_idle 1
>
> on an idle machine, showed me that this is not what is actually happening:
> $ perf script
> swapper 0 [000] 1132634.287442: 1 cycles:I:
> ffffffff8100b1fb __intel_pmu_enable_all.isra.17 ([kernel.kallsyms])
> swapper 0 [001] 1132634.287498: 1 cycles:I:
> ffffffff8100b1fb __intel_pmu_enable_all.isra.17 ([kernel.kallsyms])
>
>
> After looking at the code, it all made sense, it seems to current
> implementation is only relevant for sw events. I don't understand why.

AFAICS it's not implemented

Peter suggested some time ago change for cpu-clock (attached)
I still have it in my queue, because it gives funny numbers
sometimes.. and I haven't figured it out so far

the idea so far was to use cpu-clock,cpu-clock:I events to
count and display idle % in perf top/record and stat metrics

jirka


---