pub unsafe fn perf_event_open(
    attrs: *mut perf_event_attr,
    pid: pid_t,
    cpu: c_int,
    group_fd: c_int,
    flags: c_ulong
) -> c_int
Expand description

The perf_event_open system call.

See the perf_event_open(2) man page for details.

On error, this returns -1, and the C errno value (accessible via std::io::Error::last_os_error) is set to indicate the error.

Note: The attrs argument needs to be a *mut because if the size field is too small or too large, the kernel writes the size it was expecing back into that field. It might do other things as well.

Safety

The attrs argument must point to a properly initialized perf_event_attr struct. The measurements and other behaviors its contents request must be safe.