Skip to content

Helper function bpf_perf_prog_read_value


This helper retrieves the value of an event counter.


Copyright (c) 2015 The Libbpf Authors. All rights reserved.

Returns 0 on success, or a negative error in case of failure.

static long (* const bpf_perf_prog_read_value)(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, __u32 buf_size) = (void *) 56;


For an eBPF program attached to a perf event, retrieve the value of the event counter associated to ctx and store it in the structure pointed by buf and of size buf_size. Enabled and running times are also stored in the structure (see description of helper bpf_perf_event_read_value for more details).

Program types

This helper call can be used in the following program types:


Docs could be improved

This part of the docs is incomplete, contributions are very welcome