qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Tanase <sebastian.tanase@openwide.fr>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org,
	Sebastian Tanase <sebastian.tanase@openwide.fr>,
	jeremy.rosen@openwide.fr, alex@alex.org.uk,
	wenchaoqemu@gmail.com, quintela@redhat.com, mst@redhat.com,
	stefanha@redhat.com, armbru@redhat.com, lcapitulino@redhat.com,
	michael@walle.cc, camille.begue@openwide.fr, aliguori@amazon.com,
	crobinso@redhat.com, pbonzini@redhat.com,
	pierre.lemagourou@openwide.fr, afaerber@suse.de, rth@twiddle.net
Subject: [Qemu-devel] [PATCH V5 6/6] monitor: Add drift info to 'info jit'
Date: Fri, 25 Jul 2014 11:56:33 +0200	[thread overview]
Message-ID: <1406282193-9664-7-git-send-email-sebastian.tanase@openwide.fr> (raw)
In-Reply-To: <1406282193-9664-1-git-send-email-sebastian.tanase@openwide.fr>

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 <sebastian.tanase@openwide.fr>
Tested-by: Camille Bégué <camille.begue@openwide.fr>
---
 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 7259c94..533e0bf 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -117,6 +117,12 @@ static void init_delay_params(SyncClocks *sc,
                    sc->realtime_clock +
                    cpu_get_clock_offset();
     sc->original_instr_counter = 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) */
     print_delay(sc);
diff --git a/cpus.c b/cpus.c
index fcc5308..c98036e 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)
 {
@@ -1521,3 +1523,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 d47aa02..55971df 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -110,6 +110,10 @@ void configure_icount(QemuOpts *opts, Error **errp);
 extern int use_icount;
 extern int icount_align_option;
 extern int icount_time_shift;
+/* 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)
-- 
2.0.0.rc2

  parent reply	other threads:[~2014-07-25  9:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25  9:56 [Qemu-devel] [PATCH V5 0/6] icount: Implement delay algorithm between guest and host clocks Sebastian Tanase
2014-07-25  9:56 ` [Qemu-devel] [PATCH V5 1/6] icount: Add QemuOpts for icount Sebastian Tanase
2014-08-08  6:51   ` Markus Armbruster
2014-09-15  7:04   ` TeLeMan
2014-09-15 11:41     ` Paolo Bonzini
2014-07-25  9:56 ` [Qemu-devel] [PATCH V5 2/6] icount: Add align option to icount Sebastian Tanase
2014-07-25  9:56 ` [Qemu-devel] [PATCH V5 3/6] icount: Make icount_time_shift available everywhere Sebastian Tanase
2014-07-25  9:56 ` [Qemu-devel] [PATCH V5 4/6] cpu_exec: Add sleeping algorithm Sebastian Tanase
2014-07-25 10:13   ` Paolo Bonzini
2014-07-25 14:28     ` Sebastian Tanase
2014-07-25  9:56 ` [Qemu-devel] [PATCH V5 5/6] cpu_exec: Print to console if the guest is late Sebastian Tanase
2014-07-25  9:56 ` Sebastian Tanase [this message]
2014-07-25 10:00 ` [Qemu-devel] [PATCH V5 0/6] icount: Implement delay algorithm between guest and host clocks Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406282193-9664-7-git-send-email-sebastian.tanase@openwide.fr \
    --to=sebastian.tanase@openwide.fr \
    --cc=afaerber@suse.de \
    --cc=alex@alex.org.uk \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=camille.begue@openwide.fr \
    --cc=crobinso@redhat.com \
    --cc=jeremy.rosen@openwide.fr \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=michael@walle.cc \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pierre.lemagourou@openwide.fr \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=wenchaoqemu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).