[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 37/42] migration: use qemu_ftell to compute bandwidt
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 37/42] migration: use qemu_ftell to compute bandwidth |
Date: |
Fri, 22 Feb 2013 17:36:43 +0100 |
Prepare for when s->bytes_xfer will be removed.
Reviewed-by: Orit Wasserman <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
migration.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration.c b/migration.c
index 681a459..6da1746 100644
--- a/migration.c
+++ b/migration.c
@@ -589,6 +589,7 @@ static void *migration_thread(void *opaque)
MigrationState *s = opaque;
int64_t initial_time = qemu_get_clock_ms(rt_clock);
int64_t sleep_time = 0;
+ int64_t initial_bytes = 0;
int64_t max_size = 0;
int64_t start_time = initial_time;
bool old_vm_running = false;
@@ -629,7 +630,7 @@ static void *migration_thread(void *opaque)
}
current_time = qemu_get_clock_ms(rt_clock);
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 - sleep_time;
double bandwidth = transferred_bytes / time_spent;
max_size = bandwidth * migrate_max_downtime() / 1000000;
@@ -646,6 +647,7 @@ static void *migration_thread(void *opaque)
s->bytes_xfer = 0;
sleep_time = 0;
initial_time = current_time;
+ initial_bytes = qemu_ftell(s->file);
}
if (qemu_file_rate_limit(s->file)) {
/* usleep expects microseconds */
--
1.8.1.2
- [Qemu-devel] [PATCH 27/42] migration: detect error before sleeping, (continued)
- [Qemu-devel] [PATCH 27/42] migration: detect error before sleeping, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 28/42] migration: remove useless qemu_file_get_error check, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 26/42] migration: eliminate last_round, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 39/42] migration: move rate limiting to QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 40/42] migration: move contents of migration_close to migrate_fd_cleanup, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 42/42] migration: inline migrate_fd_close, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 41/42] migration: eliminate s->migration_file, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 15/42] migration: cleanup migration (including thread) in the iothread, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 31/42] qemu-file: fsync a writable stdio QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 17/42] block-migration: small preparatory changes for locking, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 37/42] migration: use qemu_ftell to compute bandwidth,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 35/42] migration: use QEMUFile for migration channel lifetime, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 07/42] migration: use qemu_file_set_error to pass error codes back to qemu_savevm_state, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 29/42] migration: use qemu_file_rate_limit consistently, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 33/42] qemu-file: add writable socket QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 30/42] migration: merge qemu_popen_cmd with qemu_popen, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 19/42] block-migration: add lock, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 36/42] migration: use QEMUFile for writing outgoing migration data, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 32/42] qemu-file: check exit status when closing a pipe QEMUFile, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 10/42] migration: use qemu_file_set_error, Paolo Bonzini, 2013/02/22
- [Qemu-devel] [PATCH 38/42] migration: small changes around rate-limiting, Paolo Bonzini, 2013/02/22