diff options
author | Charles William Dick <cwd@google.com> | 2020-01-10 14:31:52 +0900 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-31 05:59:32 +0000 |
commit | 664cc3ca49cb58d5bf7d936686fd211d6dd728bf (patch) | |
tree | 78fc6d497bf33209e6308c2e677b2e676db579fe /vm_control/src/lib.rs | |
parent | 31deb9fd456c876c16a624eaf04b23c7887802c6 (diff) | |
download | crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.tar crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.tar.gz crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.tar.bz2 crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.tar.lz crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.tar.xz crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.tar.zst crosvm-664cc3ca49cb58d5bf7d936686fd211d6dd728bf.zip |
crosvm virtio balloon stats
Introduces the ability to request BalloonStats from a BalloonControlCommand. BUG=b:147334004 TEST=tast run <DUT> arc.Boot.vm, and the balance available changes based on this. Change-Id: I808c4024f8c644c9cc4e30cc455ceda5f477bff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2061517 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Charles Dueck <cwd@chromium.org>
Diffstat (limited to 'vm_control/src/lib.rs')
-rw-r--r-- | vm_control/src/lib.rs | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index b2577d9..92af2c6 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -99,7 +99,33 @@ pub const USB_CONTROL_MAX_PORTS: usize = 16; #[derive(MsgOnSocket, Debug)] pub enum BalloonControlCommand { /// Set the size of the VM's balloon. - Adjust { num_bytes: u64 }, + Adjust { + num_bytes: u64, + }, + Stats, +} + +// BalloonStats holds stats returned from the stats_queue. +#[derive(Default, MsgOnSocket, Debug)] +pub struct BalloonStats { + pub swap_in: Option<u64>, + pub swap_out: Option<u64>, + pub major_faults: Option<u64>, + pub minor_faults: Option<u64>, + pub free_memory: Option<u64>, + pub total_memory: Option<u64>, + pub available_memory: Option<u64>, + pub disk_caches: Option<u64>, + pub hugetlb_allocations: Option<u64>, + pub hugetlb_failures: Option<u64>, +} + +#[derive(MsgOnSocket, Debug)] +pub enum BalloonControlResult { + Stats { + stats: BalloonStats, + balloon_actual: u64, + }, } #[derive(MsgOnSocket, Debug)] @@ -379,8 +405,8 @@ pub enum VmIrqResponse { Err(SysError), } -pub type BalloonControlRequestSocket = MsgSocket<BalloonControlCommand, ()>; -pub type BalloonControlResponseSocket = MsgSocket<(), BalloonControlCommand>; +pub type BalloonControlRequestSocket = MsgSocket<BalloonControlCommand, BalloonControlResult>; +pub type BalloonControlResponseSocket = MsgSocket<BalloonControlResult, BalloonControlCommand>; pub type DiskControlRequestSocket = MsgSocket<DiskControlCommand, DiskControlResult>; pub type DiskControlResponseSocket = MsgSocket<DiskControlResult, DiskControlCommand>; |