Struct shadow_tsc::Tsc
source · #[repr(C)]pub struct Tsc {
pub cyclesPerSecond: u64,
}
Expand description
Emulates an x86-64 processor’s timestamp counter, as read by rdtsc and rdtscp.
Fields§
§cyclesPerSecond: u64
Implementations§
source§impl Tsc
impl Tsc
sourcepub fn native_cycles_per_second() -> Option<u64>
pub fn native_cycles_per_second() -> Option<u64>
Returns the host system’s native TSC rate, or None if it couldn’t be found.
WARNING: this is known to fail completely on some supported CPUs (particularly AMD), and can return the wrong value for others. i.e. this needs more work if we need to dependably get the host’s TSC rate. e.g. see https://github.com/shadow/shadow/issues/1519.
pub fn new(cycles_per_second: u64) -> Self
sourcepub fn emulate_rdtsc(
&self,
rax: &mut u64,
rdx: &mut u64,
rip: &mut u64,
nanos: u64,
)
pub fn emulate_rdtsc( &self, rax: &mut u64, rdx: &mut u64, rip: &mut u64, nanos: u64, )
Updates registers to reflect the result of executing an rdtsc
instruction at time nanos
.
sourcepub fn emulate_rdtscp(
&self,
rax: &mut u64,
rdx: &mut u64,
rcx: &mut u64,
rip: &mut u64,
nanos: u64,
)
pub fn emulate_rdtscp( &self, rax: &mut u64, rdx: &mut u64, rcx: &mut u64, rip: &mut u64, nanos: u64, )
Updates registers to reflect the result of executing an rdtscp
instruction at time nanos
.
Auto Trait Implementations§
impl Freeze for Tsc
impl RefUnwindSafe for Tsc
impl Send for Tsc
impl Sync for Tsc
impl Unpin for Tsc
impl UnwindSafe for Tsc
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more