Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(bench)!: mo…
Browse files Browse the repository at this point in the history
…ve benchmarking facilities to their own crate
  • Loading branch information
ROMemories committed Mar 26, 2024
1 parent 9ecb6d1 commit d40ff24
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:

# TODO: we'll eventually want to enable relevant features
- name: "rustdoc"
run: cargo rustdoc -p riot-rs --features no-boards -- -D warnings
run: cargo rustdoc -p riot-rs --features no-boards,bench -- -D warnings

- name: rustfmt
run: cargo fmt --check --all
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ edition = "2021"
publish = false

[dependencies]
riot-rs = { path = "../../src/riot-rs", features = ["threading"] }
riot-rs = { path = "../../src/riot-rs", features = ["bench", "threading"] }
riot-rs-boards = { path = "../../src/riot-rs-boards" }
3 changes: 2 additions & 1 deletion src/riot-rs-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ cfg_if::cfg_if! {
mod cortexm;
use cortexm as bench;
}
else if #[cfg(capability = "sw/benchmark")] {
else if #[cfg(context = "riot-rs")] {
// When run with laze but the architecture is not supported
compile_error!("benchmarking is not supported for this architecture");
} else {
// Provide a default bench module, for arch-independent tooling
Expand Down
4 changes: 3 additions & 1 deletion src/riot-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ workspace = true
[dependencies]
document-features = { workspace = true }
linkme = { workspace = true }
riot-rs-bench = { workspace = true }
riot-rs-bench = { workspace = true, optional = true }
riot-rs-boards = { path = "../riot-rs-boards" }
riot-rs-buildinfo = { path = "../riot-rs-buildinfo" }
riot-rs-debug = { workspace = true }
Expand Down Expand Up @@ -75,6 +75,8 @@ wifi-esp = ["riot-rs-embassy/wifi-esp"]
## Enables the debug console, required to use
## [`println!`](riot_rs_debug::println).
debug-console = ["riot-rs-rt/debug-console"]
## Enables benchmarking facilities.
bench = ["dep:riot-rs-bench"]
## Prints nothing in case of panics (may help reduce binary size).
silent-panic = ["riot-rs-rt/silent-panic"]
## Allows to have no boards selected, useful to run target-independent tooling.
Expand Down
2 changes: 2 additions & 0 deletions src/riot-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#![no_std]
#![feature(doc_cfg)]

#[cfg(feature = "bench")]
#[doc(cfg(feature = "bench"))]
#[doc(inline)]
pub use riot_rs_bench as bench;
pub use riot_rs_buildinfo as buildinfo;
Expand Down
1 change: 1 addition & 0 deletions tests/benchmarks/bench_sched_yield/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ publish = false

[dependencies]
riot-rs = { workspace = true, default-features = true, features = [
"bench",
"threading",
] }
riot-rs-boards = { workspace = true }

0 comments on commit d40ff24

Please sign in to comment.