Skip to main content

Module instrument

Module instrument 

Source
Expand description

Slow-path counters, so Interest::NONE is a falsifiable claim.

The framed path is byte-identical to the byte pump, which means no assertion on forwarded bytes can distinguish Interest::NONE from Interest::OBJECTS. These counters can: they are incremented only inside code the fast path never reaches, so they are free on the fast path, need no feature gate, and the binary under test is the binary that ships.

Counters are scoped to a session, not to the process. Making them process-wide with no reset is not merely flaky — tests/actions_objects.rs::a_matching_rule_on_a_draft19_fetch_stream_reports_a_bypass asserts objects_elided == 0 while sharing a binary with five tests whose whole purpose is to elide, and cargo test runs a binary’s test functions on a thread pool. That assertion is near-certain to fail, and a counter suite that goes red for scheduling reasons gets weakened or #[ignore]d within a week — at which point the Interest::NONE proof is back to being an assertion.

There is deliberately no process-global snapshot(). Counters are read through ProxySession::counters(), which returns the Counters of one session’s Recorder. (Named in plain text rather than as an intra-doc link, so this module’s documentation builds under RUSTDOCFLAGS="-D warnings" whether or not that method is in scope here.)

The one thing that does stay process-global is the release thread’s existence and backend (release_timer_started, release_timer_backend) — a process-wide resource, not a counter, whose value is monotonic (false → true, None → Some).

Macros§

bump 🔒
One relaxed += 1 on a u64 counter.

Structs§

Counters
A snapshot of one session’s slow-path counters.
Recorder
Session-scoped counter storage.
ReleaseErrors
Observed lateness of deferred releases, in one session.

Enums§

TimerBackend
Which primitive the process-wide release thread waits on.

Constants§

BACKEND_CONDVAR 🔒
TimerBackend::Condvar.
BACKEND_NONE 🔒
No release thread has been constructed.
BACKEND_SLEEP_SLICE 🔒
TimerBackend::SleepSlice.
HIST_BUCKETS 🔒
Histogram slots. [AtomicU32; 128] is 512 bytes per session.

Statics§

RELEASE_TIMER_BACKEND 🔒
The process-wide release thread’s backend, or BACKEND_NONE.

Functions§

bucket_of 🔒
Which bucket ns falls in: two significant bits per octave.
bucket_upper_ns 🔒
The largest lateness that lands in bucket idx, in nanoseconds.
note_release_timer_started 🔒
Publish the fact that the process-wide release thread now exists.
quantile 🔒
The upper bound of the first bucket whose cumulative count reaches pct% of total. 0 when nothing was sampled.
release_timer_backend
Which backend the process-wide release thread resolved to, or None if it has not started.
release_timer_started
Whether the process-wide release thread exists.