Closed talex5 closed 10 months ago
Note: the read-resoved
benchmark got slower with this PR (from 10ns to 30ns on the benchmark machine). Probably doesn't really matter, but might be good to expose the ring_is_active
C function so we can check for tracing being disabled earlier.
This is a minimal initial version, which mostly keeps the same set of events as before.
The new
eio.runtime_events
library defines the events and their types.lib_eio/core/trace.ml
now uses this instead of using CTF.examples/trace/main.ml
shows how to subscribe to events.One slight difference is that
current_thread
has gone. It is now up to the reader to remember which thread was active. In a few places this meant recording e.g. reading a promise at the point where the fiber is resumed, not when it is enqueued.Ctx_unix
is gone. Eio tracing is now enabled whenever OCaml tracing is.This is based on @TheLortex's #554 PR, but stripped down to make reviewing easier. The main changes relative to that PR are:
eio.runtime_events
exposes a typed API for reading events, rather than exposing the types and events directly.Tracing_common
is gone.Missing features from that PR can be added in follow-on PRs.