On Thu, 2010-08-19 at 11:28 +0800, Lin Ming wrote:
its some obscure perf feature:
leader = sys_perf_event_open(&hrtimer_attr, pid, cpu, 0, 0);
sibling = sys_perf_event_open(&rapl_attr, pid, cpu, leader, 0);
will create an even group (which means that both events require to be
co-scheduled). If you then provided:
hrtimer_attr.read_format |= PERF_FORMAT_GROUP;
hrtimer_attr.sample_type |= PERF_SAMPLE_READ;
the samples from the hrtimer will contain a field like:
* { u64 nr;
* { u64 time_enabled; } && PERF_FORMAT_ENABLED
* { u64 time_running; } && PERF_FORMAT_RUNNING
* { u64 value;
* { u64 id; } && PERF_FORMAT_ID
* } cntr[nr];
* } && PERF_FORMAT_GROUP
Which contains both the hrtimer count (ns) and the RAPL count (watts).
Using that you can compute the RAPL delta between consecutive samples
and use that to weight the sample.
For perf-stat non of this is needed, since it doesn't use sampling
counters anyway ;-).
--