2022-04-11 17:23:11 -05:00
|
|
|
use core::sync::atomic::Ordering;
|
|
|
|
use kernel::TICK;
|
|
|
|
|
2022-03-11 17:13:41 -06:00
|
|
|
#[cfg(target_arch = "x86_64")]
|
|
|
|
pub fn fetch_time() -> f64 {
|
|
|
|
use x86_64::instructions::interrupts::{disable, enable};
|
|
|
|
|
|
|
|
disable();
|
|
|
|
let time = TICK.load(Ordering::Relaxed) as f64;
|
|
|
|
enable();
|
|
|
|
time
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_arch = "riscv64")]
|
|
|
|
pub fn fetch_time() -> f64 {
|
|
|
|
let time = TICK.load(Ordering::Relaxed) as f64;
|
|
|
|
time
|
|
|
|
}
|