Re: [PATCH] PERF(kernel): Cleanup power events V2

Thomas Renninger
2010-10-26T13:17:43Z

On Tuesday 26 October 2010 13:54:22 Ingo Molnar wrote:
>
> * Thomas Renninger <trenn@suse.de> wrote:
>
..
> As you state above: POWER_NONE does not make sense at all.
> > The whole thing (type= attribute that vanishes now) is
> > passed to userspace, but never gets used there because the
> > same info is in the event name:
> > cpu_frequency <-> frequency_switch <-> PSTATE
> > cpu_idle <-> power_start/power_end <-> CSTATE
>
> Ah, i see, so this 'state' enum went into the type field.
>
> So my question is, and ignore this particular enum for now, what values go into the
> state field, which field is still kept in the new events as well.
Same as before:
cpu_idle:
trace_power_start(POWER_CSTATE, 1, smp_processor_id());
+ trace_processor_idle(1, smp_processor_id());
(Ooops found a copy and paste bug in my patch where I reverted
the poll_idle event, but it should be zero...).

State in cpu_idle is identical with cpuidle registered
state. If cpuidle got registered, one should be able to calculate the
same C-state residency time and usage via state=X (cpu_idle event)
which you can grab via:
cat /sys/devices/system/cpu/cpu0/cpuidle/stateX/{time,usage}
The cpu_idle event additionally gives you the timestamps of the state
changes.
This is rather nice as userspace can grab additional info from
cpuidle sysfs layer like:
/sys/devices/system/cpu/cpu0/cpuidle/stateX/{desc,power,name}

If cpuidle is not registered, the events you get are arch specific.
I mean they are arch specific anyway, but with cpuidle you can
build up an arch independent userspace framework nicely by looking
up name/desc/power/... of an cpu_idle event in cpuidle sysfs as
described above.

Thomas