firecracker_rs_sdk/models/
balloon_stats.rs

1use serde::{Deserialize, Serialize};
2
3/// Describes the balloon device statistics.
4///
5/// This structure represents the return value requested
6/// by `GET /balloon/statistics`, which describes detailed
7/// information of the balloon device.
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub struct BalloonStats {
10    /// Target number of pages the device aims to hold.
11    /// Required: true
12    #[serde(rename = "target_pages")]
13    pub target_pages: u64,
14
15    /// Actual number of pages the device is holding.
16    /// Required: true
17    #[serde(rename = "actual_pages")]
18    pub actual_pages: u64,
19
20    /// Target amount of memory (in MiB) the device aims to hold.
21    /// Required: true
22    #[serde(rename = "target_mib")]
23    pub target_mib: u64,
24
25    /// Actual amount of memory (in MiB) the device is holding.
26    /// Required: true
27    #[serde(rename = "actual_mib")]
28    pub actual_mib: u64,
29
30    /// The amount of memory that has been swapped in (in bytes).
31    #[serde(rename = "swap_in", skip_serializing_if = "Option::is_none")]
32    pub swap_in: Option<u64>,
33
34    /// The amount of memory that has been swapped out to disk (in bytes).
35    #[serde(rename = "swap_out", skip_serializing_if = "Option::is_none")]
36    pub swap_out: Option<u64>,
37
38    /// The number of major page faults that have occurred.
39    #[serde(rename = "major_faults", skip_serializing_if = "Option::is_none")]
40    pub major_faults: Option<u64>,
41
42    /// The number of minor page faults that have occurred.
43    #[serde(rename = "minor_faults", skip_serializing_if = "Option::is_none")]
44    pub minor_faults: Option<u64>,
45
46    /// The amount of memory not being used for any purpose (in bytes).
47    #[serde(rename = "free_memory", skip_serializing_if = "Option::is_none")]
48    pub free_memory: Option<u64>,
49
50    /// The total amount of memory available (in bytes).
51    #[serde(rename = "total_memory", skip_serializing_if = "Option::is_none")]
52    pub total_memory: Option<u64>,
53
54    /// An estimate of how much memory is available (in bytes) for starting new applications
55    /// without pushing the system to swap;
56    #[serde(rename = "available_memory", skip_serializing_if = "Option::is_none")]
57    pub available_memory: Option<u64>,
58
59    /// The amount of memory, in bytes, that can be quickly reclaimed without additional I/O.
60    /// Typically these pages are used for caching files from disk.
61    #[serde(rename = "disk_caches", skip_serializing_if = "Option::is_none")]
62    pub disk_caches: Option<u64>,
63
64    /// The number of successful hugetlb page allocations in the guest.
65    #[serde(
66        rename = "hugetlb_allocations",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub hugetlb_allocations: Option<u64>,
70
71    /// The number of failed hugetlb page allocations in the guest.
72    #[serde(rename = "hugetlb_failures", skip_serializing_if = "Option::is_none")]
73    pub hugetlb_failures: Option<u64>,
74}