aboutsummaryrefslogtreecommitdiff
path: root/migration/migration-stats.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-05-15 21:57:01 +0200
committerJuan Quintela <quintela@redhat.com>2023-05-18 18:40:51 +0200
commit813cd61669e45ee6d5db09a83d03df8f0c6eb5d2 (patch)
tree7a9dc33647ab2952477c3f3ede345ad7b7759551 /migration/migration-stats.c
parent3db9c05a9006550da3a73600cec89bb995420325 (diff)
migration: Use migration_transferred_bytes() to calculate rate_limit
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20230515195709.63843-9-quintela@redhat.com>
Diffstat (limited to 'migration/migration-stats.c')
-rw-r--r--migration/migration-stats.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/migration/migration-stats.c b/migration/migration-stats.c
index feec7d7369..97759a45f3 100644
--- a/migration/migration-stats.c
+++ b/migration/migration-stats.c
@@ -24,7 +24,9 @@ bool migration_rate_exceeded(QEMUFile *f)
return true;
}
- uint64_t rate_limit_used = stat64_get(&mig_stats.rate_limit_used);
+ 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_used = rate_limit_current - rate_limit_start;
uint64_t rate_limit_max = stat64_get(&mig_stats.rate_limit_max);
if (rate_limit_max == RATE_LIMIT_DISABLED) {
@@ -51,9 +53,10 @@ void migration_rate_set(uint64_t limit)
stat64_set(&mig_stats.rate_limit_max, limit / XFER_LIMIT_RATIO);
}
-void migration_rate_reset(void)
+void migration_rate_reset(QEMUFile *f)
{
stat64_set(&mig_stats.rate_limit_used, 0);
+ stat64_set(&mig_stats.rate_limit_start, migration_transferred_bytes(f));
}
void migration_rate_account(uint64_t len)