Re: [PATCH 11/48] perf data: Support converting data from bpf_perf_event_output()

From: Jiri Olsa
Date: Tue Feb 23 2016 - 12:24:01 EST


On Mon, Feb 22, 2016 at 09:10:38AM +0000, Wang Nan wrote:

SNIP

> ---
> tools/perf/util/data-convert-bt.c | 112 +++++++++++++++++++++++++++++++++++++-
> 1 file changed, 111 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> index b722e57..70f462d 100644
> --- a/tools/perf/util/data-convert-bt.c
> +++ b/tools/perf/util/data-convert-bt.c
> @@ -352,6 +352,84 @@ static int add_tracepoint_values(struct ctf_writer *cw,
> return ret;
> }
>
> +static int
> +add_bpf_output_values(struct bt_ctf_event_class *event_class,
> + struct bt_ctf_event *event,
> + struct perf_sample *sample)
> +{
> + struct bt_ctf_field_type *len_type, *seq_type;
> + struct bt_ctf_field *len_field, *seq_field;
> + unsigned int raw_size = sample->raw_size;
> + unsigned int nr_elements = raw_size / sizeof(u32);
> + unsigned int i;
> + int ret;
> +
> + if (nr_elements * sizeof(u32) != raw_size)

could this be IS_ALIGNED(raw_size, u32)

jirka