Re: [PATCH 04/16] perf: Add ability to attach user stack dump tosample

From: Peter Zijlstra
Date: Thu May 24 2012 - 06:44:22 EST


On Wed, 2012-05-23 at 21:32 +0200, Jiri Olsa wrote:
> @@ -173,6 +174,15 @@ enum perf_sample_regs {
> };
>
> /*
> + * Values for sample_stack when PERF_SAMPLE_STACK is set.
> + * Defines stack dump to be attached to the sample.
> + */
> +enum perf_sample_stack {
> + PERF_SAMPLE_STACK_USER = 1U << 0, /* user stack */
> + PERF_SAMPLE_STACK_MAX = 1U << 1, /* non-ABI */
> +};
> +
> +/*
> * The format of the data returned by read() on a perf event fd,
> * as specified by attr.read_format:
> *
> @@ -291,6 +301,14 @@ struct perf_event_attr {
> * See asm/perf_regs.h for details.
> */
> __u64 sample_regs_user;
> +
> + __u64 sample_stack; /* enum perf_sample_stack */
> +
> + /*
> + * Defines size of the user stack to dump on samples,
> + * for sample_stack PERF_SAMPLE_STACK_USER settings.
> + */
> + __u64 sample_stack_user;
> };

And here we have a similarly weird set-up. If you're ever going to add
another type, you have to make another __u64 since clearly another type
cannot use sample_stack_user per the name.

Thus, if you get another size variable you might as well use that to
discover the state that is now sample_stack.



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