Copper Robot Clock implementation. It is a monotonic high precision clock for real time applications. It has a mock feature for testing time dependent behaviors. It is part of the Copper project but can be used independently.
pubfninitialize(){}#[inline(always)]pubfnread_raw_counter()->u64{letmut counter:u64;// SAFETY: Reading the virtual counter register is a side-effect-free CPU instruction.
unsafe{core::arch::asm!("mrs {}, cntvct_el0",out(reg) counter);}
counter
}