]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf header: Allow attributes to be written after data
authorIan Rogers <irogers@google.com>
Thu, 29 Aug 2024 15:01:51 +0000 (08:01 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 29 Aug 2024 19:17:43 +0000 (16:17 -0300)
commite9a7053da377e19ebc6f1afe55c7f75219aaef79
tree02eb771941d1c04e9991f83d9e7307de9391b303
parent10df481fda13d29c2d9893b7460b8a7095d0ccf5
perf header: Allow attributes to be written after data

With a file, to write data an offset needs to be known. Typically data
follows the event attributes in a file.

However, if processing a pipe the number of event attributes may not be
known.

It is convenient in that case to write the attributes after the data.

Expand perf_session__do_write_header() to allow this when the data
offset and size are known.

This approach may be useful for more than just taking a pipe file to
write into a data file, `perf inject --itrace` will reserve and
additional 8kb for attributes, which would be unnecessary if the
attributes were written after the data.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20240829150154.37929-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/header.c