aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorBlake Jones <[email protected]>2025-06-12 19:49:36 +0000
committerNamhyung Kim <[email protected]>2025-06-20 21:48:35 +0000
commitab38e84ba9a80581e055408e0f8c0158998fa4b9 (patch)
tree7ff430fed80abb03849ec456f826bedeb2ebaee8 /tools/perf/builtin-script.c
parentperf build: detect support for libbpf's emit_strings option (diff)
downloadkernel-ab38e84ba9a80581e055408e0f8c0158998fa4b9.tar.gz
kernel-ab38e84ba9a80581e055408e0f8c0158998fa4b9.zip
perf record: collect BPF metadata from existing BPF programs
Look for .rodata maps, find ones with 'bpf_metadata_' variables, extract their values as strings, and create a new PERF_RECORD_BPF_METADATA synthetic event using that data. The code gets invoked from the existing routine perf_event__synthesize_one_bpf_prog(). For example, a BPF program with the following variables: const char bpf_metadata_version[] SEC(".rodata") = "3.14159"; int bpf_metadata_value[] SEC(".rodata") = 42; would generate a PERF_RECORD_BPF_METADATA record with: .prog_name = <BPF program name, e.g. "bpf_prog_a1b2c3_foo"> .nr_entries = 2 .entries[0].key = "version" .entries[0].value = "3.14159" .entries[1].key = "value" .entries[1].value = "42" Each of the BPF programs and subprograms that share those variables would get a distinct PERF_RECORD_BPF_METADATA record, with the ".prog_name" showing the name of each program or subprogram. The prog_name is deliberately the same as the ".name" field in the corresponding PERF_RECORD_KSYMBOL record. This code only gets invoked if support for displaying BTF char arrays as strings is detected. Signed-off-by: Blake Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'tools/perf/builtin-script.c')
0 files changed, 0 insertions, 0 deletions