What is an idiomatic way in Rust to measure, in CPU time, how long a function takes to execute?
For wall-clock time, I measure a duration like this:
use std::time::Instant;
fn interesting_function() { /* stuff that takes some time */ }
fn main() {
let start_time = Instant::now();
interesting_function();
let duration = start_time.elapsed();
println!("{}", duration.as_secs_f64())
}