[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8E+L3DSYu0k8+e0@hirez.programming.kicks-ass.net>
Date: Fri, 13 Jan 2023 12:19:11 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, Song Liu <song@...nel.org>,
linux-s390@...r.kernel.org, x86@...nel.org, bpf@...r.kernel.org
Subject: Re: [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.
Powered by blists - more mailing lists