summaryrefslogtreecommitdiff
path: root/src/cpu/kvm/timer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/kvm/timer.cc')
-rw-r--r--src/cpu/kvm/timer.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cpu/kvm/timer.cc b/src/cpu/kvm/timer.cc
index 059d70f6b..e1f74a552 100644
--- a/src/cpu/kvm/timer.cc
+++ b/src/cpu/kvm/timer.cc
@@ -110,3 +110,37 @@ PosixKvmTimer::calcResolution()
return resolution;
}
+
+
+PerfKvmTimer::PerfKvmTimer(PerfKvmCounter &ctr,
+ int signo, float hostFactor, Tick hostFreq)
+ : BaseKvmTimer(signo, hostFactor, hostFreq),
+ hwOverflow(ctr)
+{
+ hwOverflow.enableSignals(signo);
+}
+
+PerfKvmTimer::~PerfKvmTimer()
+{
+}
+
+void
+PerfKvmTimer::arm(Tick ticks)
+{
+ hwOverflow.period(hostCycles(ticks));
+ hwOverflow.refresh(1);
+}
+
+void
+PerfKvmTimer::disarm()
+{
+ hwOverflow.stop();
+}
+
+Tick
+PerfKvmTimer::calcResolution()
+{
+ // This is a bit arbitrary, but in practice, we can't really do
+ // anything useful in less than ~1000 anyway.
+ return ticksFromHostCycles(1000);
+}