mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
migration: Move rate_limit_max and rate_limit_used to migration_stats
These way we can make them atomic and use this functions from any place. I also moved all functions that use rate_limit to migration-stats. Functions got renamed, they are not qemu_file anymore. qemu_file_rate_limit -> migration_rate_exceeded qemu_file_set_rate_limit -> migration_rate_set qemu_file_get_rate_limit -> migration_rate_get qemu_file_reset_rate_limit -> migration_rate_reset qemu_file_acct_rate_limit -> migration_rate_account. Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-Id: <20230515195709.63843-6-quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
de37f8b9c2
commit
e1fde0e038
16 changed files with 124 additions and 90 deletions
|
@ -15,6 +15,12 @@
|
|||
|
||||
#include "qemu/stats64.h"
|
||||
|
||||
/*
|
||||
* Amount of time to allocate to each "chunk" of bandwidth-throttled
|
||||
* data.
|
||||
*/
|
||||
#define BUFFER_DELAY 100
|
||||
|
||||
/*
|
||||
* If rate_limit_max is 0, there is special code to remove the rate
|
||||
* limit.
|
||||
|
@ -75,6 +81,14 @@ typedef struct {
|
|||
* Number of bytes sent during precopy stage.
|
||||
*/
|
||||
Stat64 precopy_bytes;
|
||||
/*
|
||||
* Maximum amount of data we can send in a cycle.
|
||||
*/
|
||||
Stat64 rate_limit_max;
|
||||
/*
|
||||
* Amount of data we have sent in the current cycle.
|
||||
*/
|
||||
Stat64 rate_limit_used;
|
||||
/*
|
||||
* Total number of bytes transferred.
|
||||
*/
|
||||
|
@ -87,4 +101,36 @@ typedef struct {
|
|||
|
||||
extern MigrationAtomicStats mig_stats;
|
||||
|
||||
/**
|
||||
* migration_rate_account: Increase the number of bytes transferred.
|
||||
*
|
||||
* Report on a number of bytes the have been transferred that need to
|
||||
* be applied to the rate limiting calcuations.
|
||||
*
|
||||
* @len: amount of bytes transferred
|
||||
*/
|
||||
void migration_rate_account(uint64_t len);
|
||||
|
||||
/**
|
||||
* migration_rate_get: Get the maximum amount that can be transferred.
|
||||
*
|
||||
* Returns the maximum number of bytes that can be transferred in a cycle.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void migration_rate_reset(void);
|
||||
|
||||
/**
|
||||
* migration_rate_set: Set the maximum amount that can be transferred.
|
||||
*
|
||||
* Sets the maximum amount of bytes that can be transferred in one cycle.
|
||||
*
|
||||
* @new_rate: new maximum amount
|
||||
*/
|
||||
void migration_rate_set(uint64_t new_rate);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue