Crates.io | stperf |
lib.rs | stperf |
version | 0.1.4 |
source | src |
created_at | 2018-03-25 02:51:15.667643 |
updated_at | 2018-04-01 21:20:53.060667 |
description | Simple profiling utility for single-threaded applications |
homepage | https://github.com/neonmoe/stperf |
repository | https://github.com/neonmoe/stperf |
max_upload_size | |
id | 57288 |
size | 30,134 |
stperf (single-threaded performance profiler) is a very
simple profiling utility for single-threaded applications, inspired by
hprof
.
Check out the docs.
#[macro_use]
extern crate stperf;
fn main() {
use std::thread;
use std::time::Duration;
let process = || {
perf_measure!("processing");
thread::sleep(Duration::from_millis(100));
};
for _ in 0..2 {
perf_measure!("main");
for _ in 0..2 {
perf_measure!("inner operations");
process();
}
process();
}
stperf::print();
}
Will print out:
╶──┬╼ main - 100.0%, 300 ms/loop, 2 samples
├──┬╼ inner operations - 66.7%, 200 ms/loop, 4 samples
│ └───╼ processing - 100.0%, 200 ms/loop, 4 samples
└───╼ processing - 33.3%, 100 ms/loop, 2 samples
This crate is distributed under the terms of the ISC license.