Test to understand how cargoflame works.

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

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
**/*.rs.bk

6
Cargo.lock generated Normal file
View 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
View 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

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);
}