xref: /openbmc/qemu/migration/migration-stats.h (revision 1141159c)
1 /*
2  * Migration stats
3  *
4  * Copyright (c) 2012-2023 Red Hat Inc
5  *
6  * Authors:
7  *  Juan Quintela <quintela@redhat.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  */
12 
13 #ifndef QEMU_MIGRATION_STATS_H
14 #define QEMU_MIGRATION_STATS_H
15 
16 #include "qemu/stats64.h"
17 
18 /*
19  * These are the ram migration statistic counters.  It is loosely
20  * based on MigrationStats.  We change to Stat64 any counter that
21  * needs to be updated using atomic ops (can be accessed by more than
22  * one thread).
23  */
24 typedef struct {
25     /*
26      * Number of bytes that were dirty last time that we synced with
27      * the guest memory.  We use that to calculate the downtime.  As
28      * the remaining dirty amounts to what we know that is still dirty
29      * since last iteration, not counting what the guest has dirtied
30      * since we synchronized bitmaps.
31      */
32     Stat64 dirty_bytes_last_sync;
33     /*
34      * Number of pages dirtied per second.
35      */
36     Stat64 dirty_pages_rate;
37     /*
38      * Number of times we have synchronized guest bitmaps.
39      */
40     Stat64 dirty_sync_count;
41     /*
42      * Number of times zero copy failed to send any page using zero
43      * copy.
44      */
45     Stat64 dirty_sync_missed_zero_copy;
46     /*
47      * Number of bytes sent at migration completion stage while the
48      * guest is stopped.
49      */
50     Stat64 downtime_bytes;
51     /*
52      * Number of bytes sent through multifd channels.
53      */
54     Stat64 multifd_bytes;
55     /*
56      * Number of pages transferred that were not full of zeros.
57      */
58     Stat64 normal_pages;
59     /*
60      * Number of bytes sent during postcopy.
61      */
62     Stat64 postcopy_bytes;
63     /*
64      * Number of postcopy page faults that we have handled during
65      * postcopy stage.
66      */
67     Stat64 postcopy_requests;
68     /*
69      * Number of bytes sent during precopy stage.
70      */
71     Stat64 precopy_bytes;
72     /*
73      * Total number of bytes transferred.
74      */
75     Stat64 transferred;
76     /*
77      * Number of pages transferred that were full of zeros.
78      */
79     Stat64 zero_pages;
80 } MigrationAtomicStats;
81 
82 extern MigrationAtomicStats mig_stats;
83 
84 #endif
85