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 authored and kaspar030 committed Apr 8, 2024
1 parent 926c187 commit bb7a234
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 bb7a234

Please sign in to comment.