Anthony Liguori <anth...@codemonkey.ws> wrote: > On 11/23/2010 05:02 PM, Juan Quintela wrote: >> From: Juan Quintela<quint...@trasno.org> >> >> When printing debug information for migration, print total time spent. >> >> Signed-off-by: Juan Quintela<quint...@trasno.org> >> Signed-off-by: Juan Quintela<quint...@redhat.com> >> --- >> 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(); >> > > This is hideous :-) > > Recording the time is not a bad idea but it should be stored in the > migration state and available via info migrate.
ok with me. will change. > Regards, > > Anthony Liguori > >> 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(); >>