40 #ifndef __CPU_KVM_TIMER_HH__
41 #define __CPU_KVM_TIMER_HH__
75 hostFactor(hostFactor), hostFreq(hostFreq) {};
90 virtual void arm(
Tick ticks) = 0;
PerfKvmCounter & hwOverflow
virtual Tick calcResolution()=0
Calculate the timer resolution, used by resolution() which caches the result.
Tick hostFreq
Host frequency.
void arm(Tick ticks)
Arm the timer so that it fires after a certain number of ticks.
PosixKvmTimer(int signo, clockid_t clockID, float hostFactor, Tick hostFreq)
Tick resolution()
Determine the resolution of the timer in ticks.
uint64_t hostNs(Tick ticks)
Convert a time in simulator ticks to host nanoseconds.
float hostFactor
Performance scaling factor.
Tick _resolution
Cached resolution.
uint64_t hostCycles(Tick ticks)
Convert a time in simulator ticks to host cycles.
uint64_t Tick
Tick count type.
void disarm()
Disarm the timer.
void disarm()
Disarm the timer.
An instance of a performance counter.
Tick ticksFromHostCycles(uint64_t cycles)
Convert cycles executed on the host into Ticks executed in the simulator.
virtual void arm(Tick ticks)=0
Arm the timer so that it fires after a certain number of ticks.
Tick ticksFromHostNs(uint64_t ns)
Convert nanoseconds executed on the host into Ticks executed in the simulator.
Tick calcResolution()
Calculate the timer resolution, used by resolution() which caches the result.
void arm(Tick ticks)
Arm the timer so that it fires after a certain number of ticks.
Tick calcResolution()
Calculate the timer resolution, used by resolution() which caches the result.
Timer functions to interrupt VM execution after a number of simulation ticks.
virtual void disarm()=0
Disarm the timer.
BaseKvmTimer(int signo, float hostFactor, Tick hostFreq)
Setup basic timer functionality shared by all timer implementations.
Timer based on standard POSIX timers.
PerfEvent based timer using the host's CPU cycle counter.
int signo
Signal to deliver when the timer times out.
PerfKvmTimer(PerfKvmCounter &ctr, int signo, float hostFactor, Tick hostFreq)
Create a timer that uses an existing hardware cycle counter.