so I was basically trying to benchmark one of my files in Rust, and my project structure looks like this:
RTS_assignment/
├── benches/
│ └── benchmark1.rs
├── src/
│ ├── attacking_system/
│ │ ├── mod.rs
│ │ └── missile_reloading_system.rs
│ ├── defending_system/
│ ├── environment/
│ ├── utilities/
│ │ ├── mod.rs
│ │ └── struct.rs
│ ├── lib.rs
│ └── main.rs
├── target/
├── .gitignore
├── Cargo.lock
└── Cargo.toml
Since I want to access the missile_reloading_system which is under my attacking_system, I declared it like this in my lib.rs
pub mod utilities;
pub mod attacking_system;
pub mod environment;
pub mod defending_system;
pub fn reload_missiles() {
attacking_system::missile_reloading_system::main();
}
the missile_reloading_system has its own main function that I want to benchmark, so I call this function under my benchmark.rs like this:
use criterion::{criterion_group, criterion_main, Criterion};
use RTS_benchmark::reload_missiles;
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("reload_missiles", |b| {
b.iter(|| {
reload_missiles();
})
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
But when I do this cargo bench, it returns a bunch of error to me
error[E0433]: failed to resolve: use of undeclared type
RTS_benchmark
srcattacking_systemmissile_reloading_system.rs:7:5
|
7 | use RTS_benchmark::utilities::r#struct::{Missile, MissileStorage};
use of undeclared typeRTS_benchmark
error[E0433]: failed to resolve: use of undeclared type
RTS_benchmark
srcattacking_systemmissile_reloading_system.rs:8:5
|
8 | use RTS_benchmark::utilities::rmq_functions::send;
use of undeclared typeRTS_benchmark
do anyone has any idea on what is happening?
I just wanted the benchmark results.