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>
This commit is contained in:
Juan Quintela
2023-05-15 21:57:01 +02:00
parent 3db9c05a90
commit 813cd61669
3 changed files with 13 additions and 4 deletions
+7 -1
View File
@@ -81,6 +81,10 @@ typedef struct {
* Number of bytes sent during precopy stage.
*/
Stat64 precopy_bytes;
/*
* Amount of transferred data at the start of current cycle.
*/
Stat64 rate_limit_start;
/*
* Maximum amount of data we can send in a cycle.
*/
@@ -122,8 +126,10 @@ uint64_t migration_rate_get(void);
* migration_rate_reset: Reset the rate limit counter.
*
* This is called when we know we start a new transfer cycle.
*
* @f: QEMUFile used for main migration channel
*/
void migration_rate_reset(void);
void migration_rate_reset(QEMUFile *f);
/**
* migration_rate_set: Set the maximum amount that can be transferred.