Test to understand how cargoflame works.

This commit is contained in:
2019-10-24 09:46:52 -07:00
commit 5c1ff3ed61
5 changed files with 353 additions and 0 deletions

300
src/flamegraph.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 35 KiB

33
src/main.rs Normal file
View File

@@ -0,0 +1,33 @@
use std::time::{Duration, Instant};
#[inline(never)]
fn one(runtime: Duration) {
println!("Starting one");
let start = Instant::now();
loop {
let diff = Instant::now() - start;
if diff > runtime {
return;
}
}
}
#[inline(never)]
fn two(runtime: Duration) {
println!("Starting two");
let start = Instant::now();
loop {
let diff = Instant::now() - start;
if diff > runtime {
return;
}
}
}
fn main() {
let runtime = Duration::new(2, 0);
one(runtime);
two(runtime);
one(runtime);
}