From 21681ac557b41eb0071e7305695c058344fa45b9 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Thu, 1 Oct 2026 14:38:55 +0000 Subject: [PATCH] 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. --- src/perf_profile.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/perf_profile.rs b/src/perf_profile.rs index 66442954..550c2b08 100644 --- a/src/perf_profile.rs +++ b/src/perf_profile.rs @@ -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 { - 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) { if let Some(start) = start {