(
timings: &mut Vec<PhaseTiming>,
name: impl Into<String>,
op: F,
)
| 369 | } |
| 370 | |
| 371 | async fn time_blocking<T, F>( |
| 372 | timings: &mut Vec<PhaseTiming>, |
| 373 | name: impl Into<String>, |
| 374 | op: F, |
| 375 | ) -> Result<T> |
| 376 | where |
| 377 | T: Send + 'static, |
| 378 | F: FnOnce() -> Result<T> + Send + 'static, |
| 379 | { |
| 380 | let name = name.into(); |
| 381 | let started = Instant::now(); |
| 382 | let result = tokio::task::spawn_blocking(op) |
| 383 | .await |
| 384 | .context("join blocking profile phase")?; |
| 385 | timings.push(PhaseTiming { |
| 386 | name, |
| 387 | ms: elapsed_ms(started), |
| 388 | }); |
| 389 | result |
| 390 | } |
| 391 | |
| 392 | async fn time_async<T, Fut>( |
| 393 | timings: &mut Vec<PhaseTiming>, |
no test coverage detected