aboutsummaryrefslogtreecommitdiff
path: root/src/time.rs
blob: a9ea8583a383a9233bfbdd450597006254d90aad (plain) (blame)
1
2
3
4
5
6
7
8
9

/// Read the time stamp counter.
pub unsafe fn rdtsc() -> u64 {
    let mut low: u32;
    let mut high: u32;

    asm!("rdtsc" : "={eax}" (low), "={edx}" (high));
    ((high as u64) << 32) | (low as u64)
}