Skip to content

Commit ec2d084

Browse files
authored
Add warning for perf_event_paranoid >= 3 (#40)
Paranoia settings this high don't allow even user-level perf monitoring of your own process, but that documentation can be hard to find online so this adds a warning to nudge the user in the right direction.
1 parent f04fff2 commit ec2d084

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/LinuxPerf.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,12 @@ mutable struct EventGroup
289289
end
290290
continue
291291
else
292-
if errno == Libc.EACCES && !userspace_only
293-
@warn("try to adjust /proc/sys/kernel/perf_event_paranoid to a value <= 1 or use user-space only events")
292+
if errno == Libc.EACCES
293+
if !userspace_only
294+
@warn("try to adjust /proc/sys/kernel/perf_event_paranoid to a value <= 1 or use user-space only events")
295+
else
296+
@warn("try to adjust /proc/sys/kernel/perf_event_paranoid to a value <= 2 or run with the CAP_PERFMON capability")
297+
end
294298
end
295299
error("perf_event_open error : $(Libc.strerror(errno))")
296300
end

0 commit comments

Comments
 (0)