From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57083 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PL1tX-0001GA-N2 for qemu-devel@nongnu.org; Tue, 23 Nov 2010 18:03:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PL1tN-0000qk-RX for qemu-devel@nongnu.org; Tue, 23 Nov 2010 18:03:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PL1tN-0000qe-Jk for qemu-devel@nongnu.org; Tue, 23 Nov 2010 18:03:17 -0500 From: Juan Quintela Date: Wed, 24 Nov 2010 00:02:58 +0100 Message-Id: <2ee1eb4ccf1bc79ae8fc25c850c399965f8f3e97.1290552026.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 01/10] Add spent time to migration List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Juan Quintela From: Juan Quintela When printing debug information for migration, print total time spent. Signed-off-by: Juan Quintela Signed-off-by: Juan Quintela --- migration.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/migration.c b/migration.c index 9ee8b17..4786406 100644 --- a/migration.c +++ b/migration.c @@ -26,9 +26,16 @@ #ifdef DEBUG_MIGRATION #define DPRINTF(fmt, ...) \ do { printf("migration: " fmt, ## __VA_ARGS__); } while (0) +static int64_t start, stop; +#define START_MIGRATION_CLOCK() do { start = qemu_get_clock(rt_clock); } while (0) +#define STOP_MIGRATION_CLOCK() \ + do { stop = qemu_get_clock(rt_clock) - start; \ + } while (0) #else #define DPRINTF(fmt, ...) \ do { } while (0) +#define START_MIGRATION_CLOCK() do {} while (0) +#define STOP_MIGRATION_CLOCK() do {} while (0) #endif /* Migration speed throttling */ @@ -88,6 +95,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) return -1; } + START_MIGRATION_CLOCK(); if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); @@ -127,6 +135,8 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data) if (s) s->cancel(s); + STOP_MIGRATION_CLOCK(); + DPRINTF("canceled after %lu milliseconds\n", stop); return 0; } @@ -378,6 +388,9 @@ void migrate_fd_put_ready(void *opaque) } else { state = MIG_STATE_COMPLETED; } + STOP_MIGRATION_CLOCK(); + DPRINTF("ended after %lu milliseconds\n", stop); + if (migrate_fd_cleanup(s) < 0) { if (old_vm_running) { vm_start(); -- 1.7.3.2