aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/perf2
-rw-r--r--examples/process.rs9
-rw-r--r--examples/process_diff.rs9
-rw-r--r--examples/process_full.rs9
4 files changed, 25 insertions, 4 deletions
diff --git a/bin/perf b/bin/perf
index 76bc563..93bb7b8 100755
--- a/bin/perf
+++ b/bin/perf
@@ -10,7 +10,7 @@ debug = true
EOF
fi
cargo build --release --example "$1"
-perf record -F99 --call-graph dwarf,16384 target/release/examples/"$1" --ignored > /dev/null
+time perf record -F99 --call-graph dwarf,16384 target/release/examples/"$1" --ignored > /dev/null
perf script > perf.script
perl ~/coding/src/FlameGraph/stackcollapse-perf.pl perf.script > perf.collapsed
perl ~/coding/src/FlameGraph/flamegraph.pl perf.collapsed > perf.svg
diff --git a/examples/process.rs b/examples/process.rs
index 98236f7..ea36db1 100644
--- a/examples/process.rs
+++ b/examples/process.rs
@@ -20,7 +20,14 @@ fn process_frames(frames: &[Vec<u8>]) {
fn main() {
let frames: Vec<Vec<u8>> = read_frames().collect();
- for _ in 1..100 {
+ let start = std::time::Instant::now();
+ let mut i = 0;
+ loop {
+ i += 1;
process_frames(&frames);
+ if (std::time::Instant::now() - start).as_secs() >= 30 {
+ break;
+ }
}
+ eprintln!("{} iterations", i);
}
diff --git a/examples/process_diff.rs b/examples/process_diff.rs
index 4222c6e..6132971 100644
--- a/examples/process_diff.rs
+++ b/examples/process_diff.rs
@@ -26,7 +26,14 @@ fn draw_frames(frames: &[Vec<u8>]) {
fn main() {
let frames: Vec<Vec<u8>> = read_frames().collect();
- for _ in 1..10 {
+ let start = std::time::Instant::now();
+ let mut i = 0;
+ loop {
+ i += 1;
draw_frames(&frames);
+ if (std::time::Instant::now() - start).as_secs() >= 30 {
+ break;
+ }
}
+ eprintln!("{} iterations", i);
}
diff --git a/examples/process_full.rs b/examples/process_full.rs
index c62bcb2..a49af29 100644
--- a/examples/process_full.rs
+++ b/examples/process_full.rs
@@ -23,7 +23,14 @@ fn draw_frames(frames: &[Vec<u8>]) {
fn main() {
let frames: Vec<Vec<u8>> = read_frames().collect();
- for _ in 1..10 {
+ let start = std::time::Instant::now();
+ let mut i = 0;
+ loop {
+ i += 1;
draw_frames(&frames);
+ if (std::time::Instant::now() - start).as_secs() >= 30 {
+ break;
+ }
}
+ eprintln!("{} iterations", i);
}