Test to understand how cargoflame works.
This commit is contained in:
300
src/flamegraph.svg
Normal file
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
33
src/main.rs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user