mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
vm-virtio: device: Extend the VirtioDevice trait to expose counters
The counters are a hash of counter name to (wrapping) u64 value. The interpretation layer is responsible for converting this data into a rate. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
2b4a0358de
commit
dd54883a07
@ -7,6 +7,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
|
||||
|
||||
use crate::{ActivateResult, Error, Queue};
|
||||
use std::collections::HashMap;
|
||||
use std::num::Wrapping;
|
||||
use std::sync::Arc;
|
||||
use vm_memory::{GuestAddress, GuestMemoryAtomic, GuestMemoryMmap, GuestUsize};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
@ -134,6 +136,11 @@ pub trait VirtioDevice: Send {
|
||||
fn userspace_mappings(&self) -> Vec<UserspaceMapping> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
/// Return the counters that this device exposes
|
||||
fn counters(&self) -> Option<HashMap<&'static str, Wrapping<u64>>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait providing address translation the same way a physical DMA remapping
|
||||
|
Loading…
x
Reference in New Issue
Block a user