Suggestions from code review:

- what unit is cpu_time in
 - reduce the number of digits when logging timings
This commit is contained in:
Quentin Gliech
2025-04-23 17:24:18 +02:00
parent 2e2193b806
commit 9991ebde2c

View File

@@ -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",
)
}
}