migration: migration_transferred_bytes() don't need the QEMUFile
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231025091117.6342-8-quintela@redhat.com>
This commit is contained in:
parent
e9c0eed7c2
commit
f57e5a6ce5
@ -30,7 +30,7 @@ bool migration_rate_exceeded(QEMUFile *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start);
|
uint64_t rate_limit_start = stat64_get(&mig_stats.rate_limit_start);
|
||||||
uint64_t rate_limit_current = migration_transferred_bytes(f);
|
uint64_t rate_limit_current = migration_transferred_bytes();
|
||||||
uint64_t rate_limit_used = rate_limit_current - rate_limit_start;
|
uint64_t rate_limit_used = rate_limit_current - rate_limit_start;
|
||||||
|
|
||||||
if (rate_limit_max > 0 && rate_limit_used > rate_limit_max) {
|
if (rate_limit_max > 0 && rate_limit_used > rate_limit_max) {
|
||||||
@ -56,10 +56,10 @@ void migration_rate_set(uint64_t limit)
|
|||||||
|
|
||||||
void migration_rate_reset(QEMUFile *f)
|
void migration_rate_reset(QEMUFile *f)
|
||||||
{
|
{
|
||||||
stat64_set(&mig_stats.rate_limit_start, migration_transferred_bytes(f));
|
stat64_set(&mig_stats.rate_limit_start, migration_transferred_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t migration_transferred_bytes(QEMUFile *f)
|
uint64_t migration_transferred_bytes(void)
|
||||||
{
|
{
|
||||||
uint64_t multifd = stat64_get(&mig_stats.multifd_bytes);
|
uint64_t multifd = stat64_get(&mig_stats.multifd_bytes);
|
||||||
uint64_t rdma = stat64_get(&mig_stats.rdma_bytes);
|
uint64_t rdma = stat64_get(&mig_stats.rdma_bytes);
|
||||||
|
@ -137,11 +137,9 @@ void migration_rate_set(uint64_t new_rate);
|
|||||||
/**
|
/**
|
||||||
* migration_transferred_bytes: Return number of bytes transferred
|
* migration_transferred_bytes: Return number of bytes transferred
|
||||||
*
|
*
|
||||||
* @f: QEMUFile used for main migration channel
|
|
||||||
*
|
|
||||||
* Returns how many bytes have we transferred since the beginning of
|
* Returns how many bytes have we transferred since the beginning of
|
||||||
* the migration. It accounts for bytes sent through any migration
|
* the migration. It accounts for bytes sent through any migration
|
||||||
* channel, multifd, qemu_file, rdma, ....
|
* channel, multifd, qemu_file, rdma, ....
|
||||||
*/
|
*/
|
||||||
uint64_t migration_transferred_bytes(QEMUFile *f);
|
uint64_t migration_transferred_bytes(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2704,7 +2704,7 @@ static MigThrError migration_detect_error(MigrationState *s)
|
|||||||
|
|
||||||
static void migration_calculate_complete(MigrationState *s)
|
static void migration_calculate_complete(MigrationState *s)
|
||||||
{
|
{
|
||||||
uint64_t bytes = migration_transferred_bytes(s->to_dst_file);
|
uint64_t bytes = migration_transferred_bytes();
|
||||||
int64_t end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
int64_t end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
||||||
int64_t transfer_time;
|
int64_t transfer_time;
|
||||||
|
|
||||||
@ -2730,7 +2730,7 @@ static void update_iteration_initial_status(MigrationState *s)
|
|||||||
* wrong speed calculation.
|
* wrong speed calculation.
|
||||||
*/
|
*/
|
||||||
s->iteration_start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
s->iteration_start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
||||||
s->iteration_initial_bytes = migration_transferred_bytes(s->to_dst_file);
|
s->iteration_initial_bytes = migration_transferred_bytes();
|
||||||
s->iteration_initial_pages = ram_get_total_transferred_pages();
|
s->iteration_initial_pages = ram_get_total_transferred_pages();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2749,7 +2749,7 @@ static void migration_update_counters(MigrationState *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switchover_bw = migrate_avail_switchover_bandwidth();
|
switchover_bw = migrate_avail_switchover_bandwidth();
|
||||||
current_bytes = migration_transferred_bytes(s->to_dst_file);
|
current_bytes = migration_transferred_bytes();
|
||||||
transferred = current_bytes - s->iteration_initial_bytes;
|
transferred = current_bytes - s->iteration_initial_bytes;
|
||||||
time_spent = current_time - s->iteration_start_time;
|
time_spent = current_time - s->iteration_start_time;
|
||||||
bandwidth = (double)transferred / time_spent;
|
bandwidth = (double)transferred / time_spent;
|
||||||
|
Loading…
Reference in New Issue
Block a user