DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/Cache/PathCanon/SpawnDiagnosticLogger.rs
1//! Spawn a tokio task that logs cache stats every 30 s under the `path-canon`
2//! trace tag. Optional; call from `RunTime::Setup` when the user has
3//! `Trace=path-canon` enabled.
4
5use std::time::Duration;
6
7use crate::{Cache::PathCanon::Stats, dev_log};
8
9pub fn Fn() {
10 tokio::spawn(async {
11 let mut Interval = tokio::time::interval(Duration::from_secs(30));
12
13 // skip the immediate first tick
14 Interval.tick().await;
15
16 loop {
17 Interval.tick().await;
18
19 let Snapshot = Stats::Fn();
20
21 dev_log!("path-canon", "entries={} weighted={}", Snapshot.Entries, Snapshot.WeightedSize);
22 }
23 });
24}