[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v4 07/13] timer: add cpu_icount_to_ns function.
From: |
fred . konrad |
Subject: |
[Qemu-devel] [RFC PATCH v4 07/13] timer: add cpu_icount_to_ns function. |
Date: |
Wed, 25 Jun 2014 10:26:42 +0200 |
From: KONRAD Frederic <address@hidden>
This adds cpu_icount_to_ns function which is needed for reverse execution.
It returns the time for a specific instruction.
Signed-off-by: KONRAD Frederic <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
---
cpus.c | 9 +++++++--
include/qemu/timer.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/cpus.c b/cpus.c
index 4b551f1..89c7a1a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -148,9 +148,9 @@ static int64_t cpu_get_icount_locked(int with_bias)
}
if (with_bias) {
- return timers_state.qemu_icount_bias + (icount << icount_time_shift);
+ return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount);
} else {
- return icount << icount_time_shift;
+ return cpu_icount_to_ns(icount);
}
}
@@ -167,6 +167,11 @@ int64_t cpu_get_icount(int with_bias)
return icount;
}
+int64_t cpu_icount_to_ns(int64_t icount)
+{
+ return icount << icount_time_shift;
+}
+
/* return the host CPU cycle counter and handle stop/restart */
/* Caller must hold the BQL */
int64_t cpu_get_ticks(void)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 6204cab..0ae7f28 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -752,6 +752,7 @@ static inline int64_t get_clock(void)
/* icount */
int64_t cpu_get_icount(int with_bias);
int64_t cpu_get_clock(void);
+int64_t cpu_icount_to_ns(int64_t icount);
/*******************************************/
/* host CPU ticks (if available) */
--
1.9.0
- [Qemu-devel] [RFC PATCH v4 02/13] migration: migrate icount fields., (continued)
- [Qemu-devel] [RFC PATCH v4 02/13] migration: migrate icount fields., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 01/13] icount: put icount variables into TimerState., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 03/13] migration: make qemu_savevm_state public., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 05/13] icount: check for icount clock deadline when cpu loop exits., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 04/13] icount: introduce icount timer., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 06/13] icount: make icount extra computed on icount clock as well., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 09/13] introduce reverse execution mechanism., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 07/13] timer: add cpu_icount_to_ns function.,
fred . konrad <=
- [Qemu-devel] [RFC PATCH v4 08/13] trace-events: add reverse-execution events., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 10/13] gdbstub: allow reverse execution in gdb stub., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 11/13] cpu-exec: trigger a debug request when rexec stops., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 12/13] cexe: synchronize icount on the next event., fred . konrad, 2014/06/25
- [Qemu-devel] [RFC PATCH v4 13/13] cexe: allow to enable reverse execution., fred . konrad, 2014/06/25