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

From: Peter Zijlstra
Date: Fri Jul 26 2013 - 04:57:48 EST


On Thu, Jul 25, 2013 at 11:20:24PM -0400, Vince Weaver wrote:
>
> 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.

Would it help if we changed the syntax to not look as much as real C
would?

> > >> @@ -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.

Ah, I actually considered that but then got lazy and used the 0 sized
struct idea :/


--
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/