diff --git a/crates/divan_compat/examples/Cargo.toml b/crates/divan_compat/examples/Cargo.toml index 67de38e0..30f830ca 100644 --- a/crates/divan_compat/examples/Cargo.toml +++ b/crates/divan_compat/examples/Cargo.toml @@ -29,6 +29,10 @@ harness = false name = "time" harness = false +[[bench]] +name = "time_scale" +harness = false + [[bench]] name = "the_algorithms" harness = false diff --git a/crates/divan_compat/examples/benches/time_scale.rs b/crates/divan_compat/examples/benches/time_scale.rs new file mode 100644 index 00000000..c4c8baa7 --- /dev/null +++ b/crates/divan_compat/examples/benches/time_scale.rs @@ -0,0 +1,28 @@ +fn main() { + divan::main(); +} + +#[divan::bench] +fn sleep_1ns() { + std::thread::sleep(std::time::Duration::from_nanos(1)); +} + +#[divan::bench] +fn sleep_100ns() { + std::thread::sleep(std::time::Duration::from_nanos(100)); +} + +#[divan::bench] +fn sleep_1us() { + std::thread::sleep(std::time::Duration::from_micros(1)); +} + +#[divan::bench] +fn sleep_100us() { + std::thread::sleep(std::time::Duration::from_micros(100)); +} + +#[divan::bench] +fn sleep_1ms() { + std::thread::sleep(std::time::Duration::from_millis(1)); +}