Closed edwintorok closed 1 month ago
I've rebased this PR on top of https://github.com/mirage/bechamel/pull/52 to fix the CI failures. Although there is a 500 error from OCaml-CI now, reported here: https://github.com/ocurrent/ocaml-ci/issues/946
Note that there are other errors here that prevent loading the Bechamel_perf module (and as a result any application that links it), e.g. in a virtualized environment where you don't have access to perf counters, in which case you get ENOENT back.
I'll try to fix that in a separate PR though (will probably need some mechanism to detect which events are present, in a way that doesn't cause the entire module to fail to load, currently it is not possible to write a CLI to enable the perf features conditionally, because the failure is too early). E.g. on Xen without vPMU enabled you get very little (just cpu-clock,context-switches,cpu-migrations and page-faults).
Note that there are other errors here that prevent loading the Bechamel_perf module (and as a result any application that links it), e.g. in a virtualized environment where you don't have access to perf counters, in which case you get ENOENT back.
We should probably document that first I think 👍 .
Note that there are other errors here that prevent loading the Bechamel_perf module (and as a result any application that links it), e.g. in a virtualized environment where you don't have access to perf counters, in which case you get ENOENT back.
We should probably document that first I think 👍 .
Good point, I'll update this PR to document that later today.
I added a documentation about ENOENT and what is required if the user wants to measure kernel syscalls.
Thanks!
Thanks for fixing it up and merging, I got distracted by other things.
By default my system (Fedora 40) has
kernel.perf_event_paranoid
set to 2, which doesn't allow non-root users to measure the kernel.This causes
Bechamel_perf
to fail to load when linked into a program (even if I don't actually use any of its metrics), because the perf event is opened at module startup time, and not at Measureload
time.Catch the permission error and fall back to not measuring the kernel.