1 use crate::time::TimeArch; 2 3 use super::driver::tsc::TSCManager; 4 5 pub struct X86_64TimeArch; 6 7 impl TimeArch for X86_64TimeArch { 8 fn get_cycles() -> usize { 9 unsafe { x86::time::rdtsc() as usize } 10 } 11 12 fn cal_expire_cycles(ns: usize) -> usize { 13 Self::get_cycles() + ns * TSCManager::cpu_khz() as usize / 1000000 14 } 15 } 16