lkml.org 
[lkml]   [2023]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/8] perf/core: Add perf_sample_save_raw_data() helper
On Thu, Jan 12, 2023 at 01:40:10PM -0800, Namhyung Kim wrote:
> @@ -1182,6 +1187,29 @@ static inline void perf_sample_save_callchain(struct perf_sample_data *data,
> data->sample_flags |= PERF_SAMPLE_CALLCHAIN;
> }
>
> +static inline void perf_sample_save_raw_data(struct perf_sample_data *data,
> + struct perf_raw_record *raw)
> +{
> + struct perf_raw_frag *frag = &raw->frag;
> + u32 sum = 0;
> + int size;
> +
> + do {
> + sum += frag->size;
> + if (perf_raw_frag_last(frag))
> + break;
> + frag = frag->next;
> + } while (1);
> +
> + size = round_up(sum + sizeof(u32), sizeof(u64));
> + raw->size = size - sizeof(u32);
> + frag->pad = raw->size - sum;
> +
> + data->raw = raw;
> + data->dyn_size += size;
> + data->sample_flags |= PERF_SAMPLE_RAW;
> +}

This might be a wee big for inline, but I suppose it doesn't matter too
much.

\
 
 \ /
  Last update: 2023-03-26 23:39    [W:0.104 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site