libperf: Add perf_record_header_attr_id()
authorNamhyung Kim <namhyung@kernel.org>
Fri, 25 Aug 2023 15:25:50 +0000 (08:25 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 29 Aug 2023 17:16:14 +0000 (14:16 -0300)
commitbaec60800dd4a379546f3ba311574d907a01a77d
tree7daa193bb1b98fe5b1286195293661b6eef2be09
parent9bf63282ea77a531ea58acb42fb3f40d2d1e4497
libperf: Add perf_record_header_attr_id()

The HEADER_ATTR record has an event attr followed by the id array.  But
perf data from a different version could have different size of attr.

So it cannot just use event->attr.id to access the array.  Let's add the
perf_record_header_attr_id() macro to calculate the start of the array.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230825152552.112913-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/perf/include/perf/event.h