migration: Merge ram_counters and ram_atomic_counters

Using MgrationStats as type for ram_counters mean that we didn't have
to re-declare each value in another struct. The need of atomic
counters have make us to create MigrationAtomicStats for this atomic
counters.

Create RAMStats type which is a merge of MigrationStats and
MigrationAtomicStats removing unused members.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>

---

Fix typos found by David Edmondson
This commit is contained in:
Juan Quintela 2023-02-22 15:56:45 +01:00
parent 8ebb6ecc37
commit abce5fa16d
4 changed files with 37 additions and 42 deletions

View file

@ -35,25 +35,27 @@
#include "qemu/stats64.h"
/*
* These are the migration statistic counters that need to be updated using
* atomic ops (can be accessed by more than one thread). Here since we
* cannot modify MigrationStats directly to use Stat64 as it was defined in
* the QAPI scheme, we define an internal structure to hold them, and we
* propagate the real values when QMP queries happen.
*
* IOW, the corresponding fields within ram_counters on these specific
* fields will be always zero and not being used at all; they're just
* placeholders to make it QAPI-compatible.
* These are the ram migration statistic counters. It is loosely
* based on MigrationStats. We change to Stat64 any counter that
* needs to be updated using atomic ops (can be accessed by more than
* one thread).
*/
typedef struct {
Stat64 transferred;
int64_t dirty_pages_rate;
int64_t dirty_sync_count;
uint64_t dirty_sync_missed_zero_copy;
uint64_t downtime_bytes;
Stat64 duplicate;
uint64_t multifd_bytes;
Stat64 normal;
Stat64 postcopy_bytes;
} MigrationAtomicStats;
int64_t postcopy_requests;
uint64_t precopy_bytes;
int64_t remaining;
Stat64 transferred;
} RAMStats;
extern MigrationAtomicStats ram_atomic_counters;
extern MigrationStats ram_counters;
extern RAMStats ram_counters;
extern XBZRLECacheStats xbzrle_counters;
extern CompressionStats compression_counters;