Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document what the "ERROR: perf_event_open error : Operation not supported" error means #46

Open
LilithHafner opened this issue Nov 27, 2024 · 1 comment

Comments

@LilithHafner
Copy link

I copied the example in the README and got

ulia> data = zeros(10000); @measure g(data)
ERROR: perf_event_open error : Operation not supported
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] LinuxPerf.EventGroup(types::Vector{LinuxPerf.EventType}; warn_unsupported::Bool, userspace_only::Bool, pinned::Bool, exclusive::Bool, pid::Int32)
   @ LinuxPerf ~/.julia/packages/LinuxPerf/396gD/src/LinuxPerf.jl:312
 [3] EventGroup
   @ ~/.julia/packages/LinuxPerf/396gD/src/LinuxPerf.jl:240 [inlined]
 [4] make_bench(x::Vector{Any})
   @ LinuxPerf ~/.julia/packages/LinuxPerf/396gD/src/LinuxPerf.jl:476
 [5] top-level scope
   @ ~/.julia/packages/LinuxPerf/396gD/src/LinuxPerf.jl:22

I'm guessing this means my system doesn't support these perf counters. It'd be nice to print a more helpful error message if so.

@Zentrik
Copy link
Collaborator

Zentrik commented Nov 27, 2024

Per https://man7.org/linux/man-pages/man2/perf_event_open.2.html, the error is

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.

It may be reasonable to add this as another error we specially handle at

if errno in (Libc.EINVAL,Libc.ENOENT)
if warn_unsupported
@warn("$evt_type not supported, skipping")
end
continue

But supporting all the different errors seems like code bloat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants