feat: delays in bench.rs

This commit is contained in:
cscherr 2025-07-16 12:15:25 +02:00
parent 1c4ffa19a6
commit 009ed1fb50
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7

View file

@ -18,7 +18,7 @@ macro_rules! display_results {
#[inline]
pub fn bench(pin: &mut Pin<Output<PushPull>>, delay: &mut Delay) {
bench_delay(pin, delay);
bench_crc(pin);
bench_crc(pin, delay);
}
fn bench_delay(pin: &mut Pin<Output<PushPull>>, delay: &mut Delay) {
@ -47,11 +47,13 @@ where
total / RUNS
}
fn bench_crc(pin: &mut Pin<Output<PushPull>>) {
fn bench_crc(pin: &mut Pin<Output<PushPull>>, delay: &mut Delay) {
const DATA: &[u8] = b"hello world AAAAAAAAAAAAAAAAAAAAAAA";
delay.delay_ms(50_u32);
let native = time_exec(pin, || {
Crc32Rust::checksum(DATA);
});
delay.delay_ms(50_u32);
let c_code = time_exec(pin, || {
Crc32C::checksum(DATA);
});