Bring the perf profiler under the dead-code lint

A crate-level allow(dead_code) at the top of perf_profile.rs silenced
the whole module, justified by call sites a follow-up change was to
add. With the allow removed, the compiler reports exactly one unused
item: stamp(), which has no caller on any branch.

Delete stamp(). It was the intended producer of the queued_at stamp
that record_since() consumes, but queued_at is None at every site that
builds a job, so the FMP worker queue-wait stage is never recorded
today; removing stamp() gives up that unwired path rather than any
live measurement.

record_since() has one caller, in the unix-only encrypt worker, so gate
it on cfg(unix). Without that it would be dead code on Windows once the
crate-level allow is gone.
This commit is contained in:
Johnathan Corgan
2026-10-01 22:40:40 +00:00
parent 9f8b266e5d
commit 21681ac557
+2 -18
View File
@@ -1,9 +1,3 @@
// Some entry points (e.g. `stamp`, `record_since`) are only called from
// paths that aren't yet wired up in this PR (FSP-pipelined dispatch,
// per-stage worker telemetry). Keep them in tree so the follow-up wiring
// PR is a pure call-site change.
#![allow(dead_code)]
//! Runtime perf profiler for the FMP/FSP hot path and queue handoffs.
//!
//! Avoids external dependencies (`perf`, samply, etc.) by instrumenting
@@ -191,19 +185,9 @@ pub(crate) fn enabled() -> bool {
})
}
/// Capture a timestamp for a future queue-wait measurement. Returns
/// `None` when tracing is disabled so callers can store it cheaply in
/// packet/job structs without paying `Instant::now()` in production.
#[inline]
pub(crate) fn stamp() -> Option<Instant> {
if enabled() {
Some(Instant::now())
} else {
None
}
}
/// Record time elapsed since a previously captured stamp.
// Unix-only because its one caller, the encrypt worker, is.
#[cfg(unix)]
#[inline]
pub(crate) fn record_since(stage: Stage, start: Option<Instant>) {
if let Some(start) = start {