From 9991ebde2c5fec81393f00cbbefed93add7d2834 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Wed, 23 Apr 2025 17:24:18 +0200 Subject: [PATCH] Suggestions from code review: - what unit is cpu_time in - reduce the number of digits when logging timings --- crates/context/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/context/src/lib.rs b/crates/context/src/lib.rs index b289bfcda..e7a0f3d03 100644 --- a/crates/context/src/lib.rs +++ b/crates/context/src/lib.rs @@ -54,7 +54,7 @@ struct LogContextInner { /// The number of [`Future::poll`] recorded polls: AtomicU64, - /// An approximation of the total CPU time spent in the context + /// An approximation of the total CPU time spent in the context, in nanoseconds cpu_time: AtomicU64, } @@ -142,7 +142,7 @@ impl std::fmt::Display for LogContextStats { let elapsed_ms = self.elapsed.as_nanos() as f64 / 1_000_000.; write!( f, - "polls: {polls:>3}, cpu: {cpu_time_ms:>6.3}ms, elapsed: {elapsed_ms:>6.3}ms", + "polls: {polls}, cpu: {cpu_time_ms:.1}ms, elapsed: {elapsed_ms:.1}ms", ) } }