Test to understand how cargoflame works.
This commit is contained in:
commit
5c1ff3ed61
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
**/*.rs.bk
|
||||
6
Cargo.lock
generated
Normal file
6
Cargo.lock
generated
Normal file
@ -0,0 +1,6 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "rustperf"
|
||||
version = "0.1.0"
|
||||
|
||||
12
Cargo.toml
Normal file
12
Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "rustperf"
|
||||
version = "0.1.0"
|
||||
authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
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);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user