Messages in this thread | | | Subject | Re: [PATCH 02/16] perf: Add ability to attach registers dump to sample | From | Peter Zijlstra <> | Date | Thu, 24 May 2012 11:57:20 +0200 |
| |
On Wed, 2012-05-23 at 21:32 +0200, Jiri Olsa wrote:
> --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -130,8 +130,9 @@ enum perf_event_sample_format { > PERF_SAMPLE_STREAM_ID = 1U << 9, > PERF_SAMPLE_RAW = 1U << 10, > PERF_SAMPLE_BRANCH_STACK = 1U << 11, > + PERF_SAMPLE_REGS = 1U << 12, > > - PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */ > + PERF_SAMPLE_MAX = 1U << 13, /* non-ABI */ > };
There's a comment update missing for PERF_RECORD_SAMPLE that describes the output this bit generates.
> @@ -4011,6 +4042,30 @@ void perf_output_sample(struct perf_output_handle *handle, > perf_output_put(handle, nr); > } > } > + > + if (sample_type & PERF_SAMPLE_REGS) { > + u64 mode = event->attr.sample_regs; > + > + if (mode & PERF_SAMPLE_REGS_USER) { > + u64 id = PERF_REGS_ABI_NONE; > + > + /* > + * If there are no regs to dump, notice it through > + * PERF_REGS_ABI_NONE id. > + */ > + if (data->regs_user) > + id = perf_reg_version();
OK, so I don't like this.. why does this exists at all? Why not use a length field instead?
> + perf_output_put(handle, id); > + > + if (id) { > + u64 mask = event->attr.sample_regs_user; > + perf_output_sample_regs(handle, > + data->regs_user, > + mask); > + } > + } > + } > }
| |