[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 36/41] migration: use qemu_ftell to compute bandwidt
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 36/41] migration: use qemu_ftell to compute bandwidth |
Date: |
Fri, 15 Feb 2013 18:47:08 +0100 |
Prepare for when s->bytes_xfer will be removed.
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/migration.c b/migration.c
index 68d47cd..d636c59 100644
--- a/migration.c
+++ b/migration.c
@@ -575,6 +575,7 @@ static void *migration_thread(void *opaque)
{
MigrationState *s = opaque;
int64_t initial_time = qemu_get_clock_ms(rt_clock);
+ int64_t initial_bytes = 0;
int64_t max_size = 0;
int64_t start_time = initial_time;
bool old_vm_running = false;
@@ -613,7 +614,7 @@ static void *migration_thread(void *opaque)
break;
}
if (current_time >= initial_time + BUFFER_DELAY) {
- uint64_t transferred_bytes = s->bytes_xfer;
+ uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes;
uint64_t time_spent = current_time - initial_time;
double bandwidth = transferred_bytes / time_spent;
max_size = bandwidth * migrate_max_downtime() / 1000000;
@@ -624,6 +625,7 @@ static void *migration_thread(void *opaque)
s->bytes_xfer = 0;
initial_time = current_time;
+ initial_bytes = qemu_ftell(s->file);
}
if (qemu_file_rate_limit(s->file)) {
/* usleep expects microseconds */
--
1.7.1
- Re: [Qemu-devel] [PATCH 26/41] migration: detect error before sleeping, (continued)
- [Qemu-devel] [PATCH 30/41] qemu-file: fsync a writable stdio QEMUFile, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 31/41] qemu-file: check exit status when closing a pipe QEMUFile, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 39/41] migration: move contents of migration_close to migrate_fd_cleanup, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 36/41] migration: use qemu_ftell to compute bandwidth,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 38/41] migration: move rate limiting to QEMUFile, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 41/41] migration: inline migrate_fd_close, Paolo Bonzini, 2013/02/15
- [Qemu-devel] [PATCH 40/41] migration: eliminate s->migration_file, Paolo Bonzini, 2013/02/15