aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2014-05-12 10:46:00 +0200
committerJuan Quintela <quintela@trasno.org>2014-05-14 15:24:52 +0200
commitd6ed7312d11995409bd53ef8f1a743d8877880d2 (patch)
tree497cb7ec9a672a98152d3f1c6fad1e356a46d820 /migration.c
parent35d08458a9ee5fb9c8518207cc85d0a4f2ef3165 (diff)
migration: show average throughput when migration finishes
currently the value of the throughput field contains whatever was the last calculated throughput shortly before the migration finished. This patch updates the post migration contents of the field to the average throughput. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/migration.c b/migration.c
index 52cda279af..3fc03d6687 100644
--- a/migration.c
+++ b/migration.c
@@ -662,8 +662,13 @@ static void *migration_thread(void *opaque)
qemu_mutex_lock_iothread();
if (s->state == MIG_STATE_COMPLETED) {
int64_t end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+ uint64_t transferred_bytes = qemu_ftell(s->file);
s->total_time = end_time - s->total_time;
s->downtime = end_time - start_time;
+ if (s->total_time) {
+ s->mbps = (((double) transferred_bytes * 8.0) /
+ ((double) s->total_time)) / 1000;
+ }
runstate_set(RUN_STATE_POSTMIGRATE);
} else {
if (old_vm_running) {