This accidentally didn't go to the list although it's been sent there
(using git send-email)...
Michal
Original Message
Subject:[PATCH] Introduce info migrate-times monitor command
Date: Tue, 12 Jul 2011 15:28:27 +0200
From: Michal Novotny mig...@gmail.com
To: qemu-devel@nongnu.org
CC: Michal Novotny minov...@redhat.com, Michal Novotny
mig...@gmail.com
From: Michal Novotny minov...@redhat.com
Hi,
this is the implementation of the info migrate-times command
I did to get the times for the migration to get times for each
migration stage. Based on the fact migration itself is just the
vmsave on the source host and vmload on destination host this
function can be also useful to get the save times however it's
main purpose is measuring the migration times therefore it's
called info migrate-times. The total memory transferred
during the last migration is being tracked there as well as
total migration time, time of waiting for input data, times
for various migration stages for total value, disk (if
applicable) and ram memory transfer. There's also the time
difference which is the inaccuracy value which is caused by
block device flushing and also the qemu_get_clock_ns() is
being used in there and subsequent calls of this function
may result into minor inaccuracies (in the matter smaller than
of milliseconds).
I also did the testing with various migration speed settings
(using the set_migrate_speed monitor command) for 7 GiB
RHEL-6 i386 guest running bonnie++ test for 14 GiB (2x RAM)
and the results were as follows:
Max.speed |Memory transferred |Time (s)
--+-+
32m | 12 925 676 bytes | 199 s
64m |7 745 224 bytes | 26 s
128m |7 674 188 bytes | 16 s
256m |7 628 988 bytes | 16 s
512m |7 599 837 bytes | 15 s
1024m (1g) |7 592 934 bytes | 14 s
10g |7 583 824 bytes | 13 s
This has been tested on the 1 GiB network using the remote
migration.
The output of the command for last iteration (shown as an
example was):
(qemu) info migrate-times
Total transferred memory: 7583824 kbytes
Total migration time: 13.552894 s
Waiting for input data: 6.942414 s
Time difference (inaccuracy): 0.018257 s
Times for total stage 1: 0.020247 s
Times for total stage 2: 6.355092 s
Times for total stage 3: 0.253398 s
Times for total total: 6.628737 s
Times for ram stage 1: 0.020238 s
Times for ram stage 2: 6.353832 s
Times for ram stage 3: 0.228953 s
Times for ram total: 6.603023 s
(qemu)
So please review. This patch could be useful for getting
the migration stage times.
Thanks,
Michal
Signed-off-by: Michal Novotny mig...@gmail.com
---
arch_init.c | 12 +-
block-migration.c |5 ++
migration.c | 105 +
migration.h |4 ++
monitor.c |8 +++
savevm.c | 50 ++---
sysemu.h |6 +++
vl.c | 123 +
8 files changed, 305 insertions(+), 8 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 484b39d..684ae3c 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -252,8 +252,12 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage,
void *opaque)
{
ram_addr_t addr;
uint64_t bytes_transferred_last;
+uint64_t t_start;
double bwidth = 0;
uint64_t expected_time = 0;
+int retval = 0;
+
+t_start = qemu_get_clock_ns(host_clock);
if (stage 0) {
cpu_physical_memory_set_dirty_tracking(0);
@@ -272,6 +276,10 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage,
void *opaque)
last_offset = 0;
sort_ram_list();
+time_set(ram, 1, 0);
+time_set(ram, 2, 0);
+time_set(ram, 3, 0);
+
/* Make sure all dirty bits are set */
QLIST_FOREACH(block, ram_list.blocks, next) {
for (addr = block-offset; addr block-offset + block-length;
@@ -331,8 +339,10 @@ int ram_save_live(Monitor *mon, QEMUFile *f, int stage,
void *opaque)
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
+retval = (stage == 2) (expected_time = migrate_max_downtime());
-return (stage == 2) (expected_time = migrate_max_downtime());
+time_add2(ram, stage, qemu_get_clock_ns(host_clock), t_start);
+return retval;
}
static inline void *host_from_stream_offset(QEMUFile *f,
diff --git a/block-migration.c b/block-migration.c
index 0936c7d..b53a1f4 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -17,6 +17,8 @@
#include qemu-queue.h
#include qemu-timer.h
#include monitor.h
+#include qemu-timer.h
+#include sysemu.h
#include block-migration.h
#include migration.h
#include blockdev.h
@@ -556,6 +558,7