From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa6xu-0007nb-1A for qemu-devel@nongnu.org; Fri, 03 Oct 2014 13:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xa6xl-00018W-Ek for qemu-devel@nongnu.org; Fri, 03 Oct 2014 13:48:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa6xl-000171-63 for qemu-devel@nongnu.org; Fri, 03 Oct 2014 13:48:17 -0400 From: "Dr. David Alan Gilbert (git)" Date: Fri, 3 Oct 2014 18:47:11 +0100 Message-Id: <1412358473-31398-6-git-send-email-dgilbert@redhat.com> In-Reply-To: <1412358473-31398-1-git-send-email-dgilbert@redhat.com> References: <1412358473-31398-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH v4 05/47] improve DPRINTF macros, add to savevm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, lilei@linux.vnet.ibm.com, quintela@redhat.com, cristian.klein@cs.umu.se, amit.shah@redhat.com, yanghy@cn.fujitsu.com From: "Dr. David Alan Gilbert" Improve the existing DPRINTF macros in migration.c and arch_init by: 1) Making them go to stderr rather than stdout (so you can run with -nographic and redirect your debug to a file) 2) Making them print the ms time with each debug - useful for debugging latency issues Add the same macro to savevm Signed-off-by: Dr. David Alan Gilbert --- arch_init.c | 5 ++++- migration.c | 12 ++++++++++++ savevm.c | 10 ++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch_init.c b/arch_init.c index c974f3f..772de36 100644 --- a/arch_init.c +++ b/arch_init.c @@ -53,9 +53,12 @@ #include "hw/acpi/acpi.h" #include "qemu/host-utils.h" +// #define DEBUG_ARCH_INIT #ifdef DEBUG_ARCH_INIT #define DPRINTF(fmt, ...) \ - do { fprintf(stdout, "arch_init: " fmt, ## __VA_ARGS__); } while (0) + do { fprintf(stderr, "arch_init@%" PRId64 " " fmt "\n", \ + qemu_clock_get_ms(QEMU_CLOCK_REALTIME), \ + ## __VA_ARGS__); } while (0) #else #define DPRINTF(fmt, ...) \ do { } while (0) diff --git a/migration.c b/migration.c index 8d675b3..e241370 100644 --- a/migration.c +++ b/migration.c @@ -26,6 +26,18 @@ #include "qmp-commands.h" #include "trace.h" +//#define DEBUG_MIGRATION + +#ifdef DEBUG_MIGRATION +#define DPRINTF(fmt, ...) \ + do { fprintf(stderr, "migration@%" PRId64 " " fmt "\n", \ + qemu_clock_get_ms(QEMU_CLOCK_REALTIME), \ + ## __VA_ARGS__); } while (0) +#else +#define DPRINTF(fmt, ...) \ + do { } while (0) +#endif + enum { MIG_STATE_ERROR = -1, MIG_STATE_NONE, diff --git a/savevm.c b/savevm.c index e19ae0a..c3a1f68 100644 --- a/savevm.c +++ b/savevm.c @@ -43,6 +43,16 @@ #include "block/snapshot.h" #include "block/qapi.h" +#ifdef DEBUG_SAVEVM +#define DPRINTF(fmt, ...) \ + do { fprintf(stderr, "savevm@%" PRId64 " " fmt "\n", \ + qemu_clock_get_ms(QEMU_CLOCK_REALTIME), \ + ## __VA_ARGS__); } while (0) +#else +#define DPRINTF(fmt, ...) \ + do { } while (0) +#endif + #ifndef ETH_P_RARP #define ETH_P_RARP 0x8035 -- 1.9.3