#events #recording #analyzing #delays #histogram #hdr-histogram #sampler #high-dynamic-range

tokio-eld

Histogram-based sampler for recording and analyzing event loop delays

2 unstable releases

0.2.0 Nov 17, 2024
0.1.0 Nov 16, 2024

#2421 in Asynchronous

Download history 3293/week @ 2025-11-20 3361/week @ 2025-11-27 4547/week @ 2025-12-04 4731/week @ 2025-12-11 3263/week @ 2025-12-18 1733/week @ 2025-12-25 2627/week @ 2026-01-01 3730/week @ 2026-01-08 4010/week @ 2026-01-15 4754/week @ 2026-01-22 5952/week @ 2026-01-29 6586/week @ 2026-02-05 8541/week @ 2026-02-12 8638/week @ 2026-02-19 7701/week @ 2026-02-26 11190/week @ 2026-03-05

37,343 downloads per month
Used in 13 crates (via deno_node)

MIT/Apache

7KB
82 lines

tokio_eld provides a histogram-based sampler for recording and analyzing event loop delays in a current_thread Tokio runtime. The API is similar to Node.js's perf_hooks.monitorEventLoopDelay().

EldHistogram

EldHistogram supports recording and analyzing event loop delay using a High Dynamic Range (HDR) Histogram. The recorded delays are in nanoseconds.

Refer to documentation for hdrhistogram::Histogram for more information on how to use the core data structure.

Usage

use tokio_eld::EldHistogram;

let mut h = EldHistogram::<u64>::new(20).unwrap();
h.start();
// do some work
h.stop();

println!("min: {}", h.min());
println!("max: {}", h.max());
println!("mean: {}", h.mean());
println!("stddev: {}", h.stdev());
println!("p50: {}", h.value_at_percentile(50.0));
println!("p90: {}", h.value_at_percentile(90.0));

Crates.io

Documentation

tokio_eld provides a histogram-based sampler for recording and analyzing event loop delays in a current_thread Tokio runtime. The API is similar to Node.js's perf_hooks.monitorEventLoopDelay().

use tokio_eld::EldHistogram;

let mut histogram = EldHistogram::<u64>::new(20)?; // 20 ms resolution

h.start();
// do some work
h.stop();

println!("min: {}", h.min());
println!("max: {}", h.max());
println!("mean: {}", h.mean());
println!("stddev: {}", h.stdev());
println!("p50: {}", h.value_at_percentile(50.0));
println!("p90: {}", h.value_at_percentile(90.0));

Dependencies

~2.2–3MB
~44K SLoC