[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/11] monitor: Add drift info to 'info jit'
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 10/11] monitor: Add drift info to 'info jit' |
Date: |
Wed, 6 Aug 2014 18:12:34 +0200 |
From: Sebastian Tanase <address@hidden>
Show in 'info jit' the current delay between the host clock
and the guest clock. In addition, print the maximum advance
and delay of the guest compared to the host.
Signed-off-by: Sebastian Tanase <address@hidden>
Tested-by: Camille Bégué <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpu-exec.c | 6 ++++++
cpus.c | 15 +++++++++++++++
include/qemu-common.h | 4 ++++
monitor.c | 1 +
4 files changed, 26 insertions(+)
diff --git a/cpu-exec.c b/cpu-exec.c
index 3c14502..cbc8067 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -105,6 +105,12 @@ static void init_delay_params(SyncClocks *sc,
sc->realtime_clock +
cpu_get_clock_offset();
sc->last_cpu_icount = cpu->icount_extra + cpu->icount_decr.u16.low;
+ if (sc->diff_clk < max_delay) {
+ max_delay = sc->diff_clk;
+ }
+ if (sc->diff_clk > max_advance) {
+ max_advance = sc->diff_clk;
+ }
/* Print every 2s max if the guest is late. We limit the number
of printed messages to NB_PRINT_MAX(currently 100) */
diff --git a/cpus.c b/cpus.c
index 19245e9..a5f78c1 100644
--- a/cpus.c
+++ b/cpus.c
@@ -64,6 +64,8 @@
#endif /* CONFIG_LINUX */
static CPUState *next_cpu;
+int64_t max_delay;
+int64_t max_advance;
bool cpu_is_stopped(CPUState *cpu)
{
@@ -1552,3 +1554,16 @@ void qmp_inject_nmi(Error **errp)
error_set(errp, QERR_UNSUPPORTED);
#endif
}
+
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf)
+{
+ cpu_fprintf(f, "Host - Guest clock %ld(ms)\n",
+ (cpu_get_clock() - cpu_get_icount())/SCALE_MS);
+ if (icount_align_option) {
+ cpu_fprintf(f, "Max guest delay %ld(ms)\n", -max_delay/SCALE_MS);
+ cpu_fprintf(f, "Max guest advance %ld(ms)\n", max_advance/SCALE_MS);
+ } else {
+ cpu_fprintf(f, "Max guest delay NA\n");
+ cpu_fprintf(f, "Max guest advance NA\n");
+ }
+}
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 5d10ac2..bcf7a6a 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -109,6 +109,10 @@ static inline char *realpath(const char *path, char
*resolved_path)
void configure_icount(QemuOpts *opts, Error **errp);
extern int use_icount;
extern int icount_align_option;
+/* drift information for info jit command */
+extern int64_t max_delay;
+extern int64_t max_advance;
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
#include "qemu/osdep.h"
#include "qemu/bswap.h"
diff --git a/monitor.c b/monitor.c
index 5bc70a6..cdbaa60 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1047,6 +1047,7 @@ static void do_info_registers(Monitor *mon, const QDict
*qdict)
static void do_info_jit(Monitor *mon, const QDict *qdict)
{
dump_exec_info((FILE *)mon, monitor_fprintf);
+ dump_drift_info((FILE *)mon, monitor_fprintf);
}
static void do_info_history(Monitor *mon, const QDict *qdict)
--
1.9.3
- [Qemu-devel] [PULL 02/11] icount: put icount variables into TimerState., (continued)
- [Qemu-devel] [PULL 02/11] icount: put icount variables into TimerState., Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 03/11] migration: migrate icount fields., Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 04/11] timer: add cpu_icount_to_ns function., Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 01/11] backends: Introduce chr-testdev, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 05/11] icount: Fix virtual clock start value on ARM, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 06/11] icount: Add QemuOpts for icount, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 07/11] icount: Add align option to icount, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 08/11] cpu-exec: Add sleeping algorithm, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 09/11] cpu-exec: Print to console if the guest is late, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 11/11] target-mips: Ignore unassigned accesses with KVM, Paolo Bonzini, 2014/08/06
- [Qemu-devel] [PULL 10/11] monitor: Add drift info to 'info jit',
Paolo Bonzini <=
- Re: [Qemu-devel] [PULL 00/11] KVM, icount changes for 2014-08-06, Peter Maydell, 2014/08/07