Re: [PATCH] perf_counter: Always return the parent counter id to userspace

Anton Blanchard
2009-07-20T11:52:16Z

Hi Peter,

> Please add -p to your diff args, or use
> QUILT_DIFF_OPTS="--show-c-function".

Sorry about that, I lost my .quiltrc somewhere along the line.

> > @@ -2704,8 +2718,10 @@
> > if (sample_type & PERF_SAMPLE_ADDR)
> > perf_output_put(&handle, data->addr);
> >
> > - if (sample_type & PERF_SAMPLE_ID)
> > - perf_output_put(&handle, counter->id);
> > + if (sample_type & PERF_SAMPLE_ID) {
> > + u64 id = primary_counter_id(counter);
> > + perf_output_put(&handle, id);
> > + }
> >
> > if (sample_type & PERF_SAMPLE_CPU)
> > perf_output_put(&handle, cpu_entry);
>
> This will actually wreck things.
>
> It would be impossible to relate PERF_EVENT_PERIOD/THROTTLE (and maybe
> others) to their respective counters.
>
> If you have inherited counters and each task will have separate ones,
> you need separate IDs in their sample stream to be able to related
> PERIOD and THROTTLE events.

I think I'm missing something. I'm logging two events at once with perf record
(-e page-faults -e dTLB-load-misses) and I added PERF_SAMPLE_ID to be able to
identify each event in the output file.

I'm not seeing a way to inherit and share counters (so we always get a
consistent id which matches the perf.data header), or a way for the new
counters to be written out to the log as they are created (so I can work
back to the original id).

Anton