]> Git Repo - qemu.git/commitdiff
augment info migrate with page status
authorGlauber Costa <[email protected]>
Thu, 21 May 2009 21:38:01 +0000 (17:38 -0400)
committerAnthony Liguori <[email protected]>
Fri, 22 May 2009 15:50:29 +0000 (10:50 -0500)
This patch augments info migrate output with status about:
* ram bytes remaining
* ram bytes transferred
* ram bytes total

This should be enough for management tools to realize
whether or not there is progress in migration. We can
add more information later on, if the need arrives

[v2: fixes bytes_transferred type]

Signed-off-by: Glauber Costa <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
migration.c
sysemu.h
vl.c

index ca397faf71c373e9bf7e18dd44756a297cf39690..cccc2d159041caef1228ad3958865e9a64f0430b 100644 (file)
@@ -109,6 +109,9 @@ void do_info_migrate(Monitor *mon)
         switch (s->get_status(s)) {
         case MIG_STATE_ACTIVE:
             monitor_printf(mon, "active\n");
+            monitor_printf(mon, "transferred ram: %" PRIu64 " kbytes\n", ram_bytes_transferred() >> 10);
+            monitor_printf(mon, "remaining ram: %" PRIu64 " kbytes\n", ram_bytes_remaining() >> 10);
+            monitor_printf(mon, "total ram: %" PRIu64 " kbytes\n", ram_bytes_total() >> 10);
             break;
         case MIG_STATE_COMPLETED:
             monitor_printf(mon, "completed\n");
index 4063533f2b209f31848d0cbf3d26730c2c6e9771..a1dadaa42af0337a39ca4ecba15e70e3dd4129f6 100644 (file)
--- a/sysemu.h
+++ b/sysemu.h
@@ -28,6 +28,10 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
 void vm_start(void);
 void vm_stop(int reason);
 
+uint64_t ram_bytes_remaining(void);
+uint64_t ram_bytes_transferred(void);
+uint64_t ram_bytes_total(void);
+
 int64_t cpu_get_ticks(void);
 void cpu_enable_ticks(void);
 void cpu_disable_ticks(void);
diff --git a/vl.c b/vl.c
index a24692c42837bb8f56d154d842dec6f3b2aa1c24..5dfeb46b6442674d218adb6992354856d3892a4b 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -3234,6 +3234,7 @@ static int ram_save_block(QEMUFile *f)
 }
 
 static ram_addr_t ram_save_threshold = 10;
+static uint64_t bytes_transferred = 0;
 
 static ram_addr_t ram_save_remaining(void)
 {
@@ -3248,6 +3249,21 @@ static ram_addr_t ram_save_remaining(void)
     return count;
 }
 
+uint64_t ram_bytes_remaining(void)
+{
+    return ram_save_remaining() * TARGET_PAGE_SIZE;
+}
+
+uint64_t ram_bytes_transferred(void)
+{
+    return bytes_transferred;
+}
+
+uint64_t ram_bytes_total(void)
+{
+    return last_ram_offset;
+}
+
 static int ram_save_live(QEMUFile *f, int stage, void *opaque)
 {
     ram_addr_t addr;
@@ -3269,6 +3285,7 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
         int ret;
 
         ret = ram_save_block(f);
+        bytes_transferred += ret * TARGET_PAGE_SIZE;
         if (ret == 0) /* no more blocks */
             break;
     }
@@ -3278,7 +3295,9 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
     if (stage == 3) {
 
         /* flush all remaining blocks regardless of rate limiting */
-        while (ram_save_block(f) != 0);
+        while (ram_save_block(f) != 0) {
+            bytes_transferred += TARGET_PAGE_SIZE;
+        }
         cpu_physical_memory_set_dirty_tracking(0);
     }
 
This page took 0.037553 seconds and 4 git commands to generate.