ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
540 stars 66 forks source link

Switch from CTF to OCaml 5.1 runtime events #635

Closed talex5 closed 10 months ago

talex5 commented 10 months ago

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:

Missing features from that PR can be added in follow-on PRs.

talex5 commented 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.