Re: [tip:perf/core] perf: Update perf_event_type documentation

From: Vince Weaver
Date: Thu Jul 25 2013 - 23:19:40 EST



On Thu, 25 Jul 2013, Adrian Hunter wrote:

> >> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> >> index 0b1df41..00d8274 100644
> >> --- a/include/uapi/linux/perf_event.h
> >> +++ b/include/uapi/linux/perf_event.h
> >> @@ -478,6 +478,16 @@ enum perf_event_type {
> >> * file will be supported by older perf tools, with these new optional
> >> * fields being ignored.
> >> *
> >> + * struct sample_id {
> >> + * { u32 pid, tid; } && PERF_SAMPLE_TID
> >> + * { u64 time; } && PERF_SAMPLE_TIME
> >> + * { u64 id; } && PERF_SAMPLE_ID
> >> + * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
> >> + * { u32 cpu, res; } && PERF_SAMPLE_CPU
> >> + * } && perf_event_attr::sample_id_all
> >> + */
> >> +

a thing that personally bothers me are these imaginary struct definitions
added as part of the documentation that aren't actually available in the
public perf_event.h

I can see why it's done, but it can be confusing picking out in later
definitions which struct fields are real and which ones are conceptual.

> >> @@ -498,6 +508,7 @@ enum perf_event_type {
> >> * struct perf_event_header header;
> >> * u64 id;
> >> * u64 lost;
> >> + * struct sample_id sample_id;
> >> * };

This is what confused me; this documentation shows the sample_id
as always being there, but in reality that struct is only there
if perf_event_attr::sample_id_all is set.

It might be clearer
if you stuck the perf_event_attr::sample_id_all qualifier each
place you add the sample_id field.

And it's nice that the header holds a size field which ensures backward
compatability, I somehow had forgotten that with my initial complaint.

Vince
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/