future_profiler/profiler/
mod.rs1use crate::Profiler;
4use std::time::Duration;
5
6#[cfg(feature = "perf")]
7mod cpu_profiler;
8#[cfg(feature = "perf")]
9pub use cpu_profiler::*;
10
11pub struct DefaultProfiler {}
12
13impl Profiler for DefaultProfiler {
14 fn new() -> Self {
15 Self {}
16 }
17
18 fn prepare(&mut self) {
19 }
21
22 fn update(&mut self) {
23 }
25
26 fn finish(&self, label: &str, wake_time: Duration, sleep_time: Duration) {
27 println!(
28 "FutureProfiler: {}, wake_time: {:.3} ms, sleep_time: {:.3} ms",
29 label,
30 wake_time.as_micros() as f64 * 0.001,
31 sleep_time.as_micros() as f64 * 0.001,
32 );
33 }
34
35 fn error(&self, label: &str) {
36 eprintln!("FutureProfiler: {label} was not polled to completion");
37 }
38}