настроить мониторинг производительности (set up performance monitoring)
Ошибки (Error)
The errors returned by perf_event_open
() can be inconsistent, and
may vary across processor architectures and performance
monitoring units.
E2BIG
Returned if the perf_event_attr size value is too small
(smaller than PERF_ATTR_SIZE_VER0
), too big (larger than
the page size), or larger than the kernel supports and the
extra bytes are not zero. When E2BIG
is returned, the
perf_event_attr size field is overwritten by the kernel to
be the size of the structure it was expecting.
EACCES
Returned when the requested event requires CAP_PERFMON
(since Linux 5.8) or CAP_SYS_ADMIN
permissions (or a more
permissive perf_event paranoid setting). Some common
cases where an unprivileged process may encounter this
error: attaching to a process owned by a different user;
monitoring all processes on a given CPU (i.e., specifying
the pid argument as -1); and not setting exclude_kernel
when the paranoid setting requires it.
EBADF
Returned if the group_fd file descriptor is not valid, or,
if PERF_FLAG_PID_CGROUP
is set, the cgroup file descriptor
in pid is not valid.
EBUSY
(since Linux 4.1)
Returned if another event already has exclusive access to
the PMU.
EFAULT
Returned if the attr pointer points at an invalid memory
address.
EINTR
Returned when trying to mix perf and ftrace handling for a
uprobe.
EINVAL
Returned if the specified event is invalid. There are
many possible reasons for this. A not-exhaustive list:
sample_freq is higher than the maximum setting; the cpu to
monitor does not exist; read_format is out of range;
sample_type is out of range; the flags value is out of
range; exclusive or pinned set and the event is not a
group leader; the event config values are out of range or
set reserved bits; the generic event selected is not
supported; or there is not enough room to add the selected
event.
EMFILE
Each opened event uses one file descriptor. If a large
number of events are opened, the per-process limit on the
number of open file descriptors will be reached, and no
more events can be created.
ENODEV
Returned when the event involves a feature not supported
by the current CPU.
ENOENT
Returned if the type setting is not valid. This error is
also returned for some unsupported generic events.
ENOSPC
Prior to Linux 3.3, if there was not enough room for the
event, ENOSPC
was returned. In Linux 3.3, this was
changed to EINVAL
. ENOSPC
is still returned if you try to
add more breakpoint events than supported by the hardware.
ENOSYS
Returned if PERF_SAMPLE_STACK_USER
is set in sample_type
and it is not supported by hardware.
EOPNOTSUPP
Returned if an event requiring a specific hardware feature
is requested but there is no hardware support. This
includes requesting low-skid events if not supported,
branch tracing if it is not available, sampling if no PMU
interrupt is available, and branch stacks for software
events.
EOVERFLOW
(since Linux 4.8)
Returned if PERF_SAMPLE_CALLCHAIN
is requested and
sample_max_stack is larger than the maximum specified in
/proc/sys/kernel/perf_event_max_stack.
EPERM
Returned on many (but not all) architectures when an
unsupported exclude_hv, exclude_idle, exclude_user, or
exclude_kernel setting is specified.
It can also happen, as with EACCES
, when the requested
event requires CAP_PERFMON
(since Linux 5.8) or
CAP_SYS_ADMIN
permissions (or a more permissive perf_event
paranoid setting). This includes setting a breakpoint on
a kernel address, and (since Linux 3.13) setting a kernel
function-trace tracepoint.
ESRCH
Returned if attempting to attach to a process that does
not exist.