mitchellh / libxev

libxev is a cross-platform, high-performance event loop that provides abstractions for non-blocking IO, timers, events, and more and works on Linux (io_uring or epoll), macOS (kqueue), and Wasm + WASI. Available as both a Zig and C API.
MIT License
2.07k stars 74 forks source link

Feature request: profile benchmarking "mode" #46

Open RossComputerGuy opened 1 year ago

RossComputerGuy commented 1 year ago

I'm looking for a way to effectively benchmark my libxev event loops per iteration of the loop. It may be possible to write libxev to have a comptime enabled "profiling mode" which measures the speed of each completion and each iteration of the loop. The benefit of doing this in libxev would be that it's standard and doesn't rely on some trickery. The only real issue I see here is determining what measurement should be used. Maybe it's possible to set different ones through an enum, some options could possibly be real_time, cpu_time, etc. It should also be possible to hook into some sort of method to retrieve the data so it may be logged by the developer.