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