Skip to content

Commit

Permalink
feat(benchmark-example): print benchmark errors if any
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMemories committed Apr 8, 2024
1 parent 5d8f1ae commit 052e2bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ use riot_rs::debug::println;

#[riot_rs::thread(autostart)]
fn main() {
match riot_rs::bench::benchmark(10000, || {
//
match riot_rs::bench::benchmark(1000, || {
// Insert the function to benchmark here.
// Consider using `core::hint::black_box()` where necessary.
}) {
Ok(ticks) => {
println!("took {} per iteration", ticks);
}
Err(_) => {
println!("benchmark returned error");
Err(err) => {
println!("benchmark returned error: {}", err);
}
}
}

0 comments on commit 052e2bd

Please sign in to comment.