MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / time_async

Function time_async

examples/tauri-sqlx-vanilla/src-tauri/src/bench.rs:392–408  ·  view source on GitHub ↗
(
    timings: &mut Vec<PhaseTiming>,
    name: impl Into<String>,
    fut: Fut,
)

Source from the content-addressed store, hash-verified

390}
391
392async fn time_async<T, Fut>(
393 timings: &mut Vec<PhaseTiming>,
394 name: impl Into<String>,
395 fut: Fut,
396) -> Result<T>
397where
398 Fut: Future<Output = Result<T>>,
399{
400 let name = name.into();
401 let started = Instant::now();
402 let result = fut.await;
403 timings.push(PhaseTiming {
404 name,
405 ms: elapsed_ms(started),
406 });
407 result
408}
409
410async fn measure_iterations<F, Fut>(
411 label: &str,

Callers 2

startMethod · 0.85
profileMethod · 0.85

Calls 2

elapsed_msFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected