Skip to content

Commit a396042

Browse files
committed
vmm: Add device reset metric
1 parent 88512b9 commit a396042

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/vmm/src/devices/virtio/net/device.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ impl VirtioDevice for Net {
10351035
self.device_state = DeviceState::Inactive;
10361036
self.rx_frame_buf = [0u8; MAX_BUFFER_SIZE];
10371037
self.acked_features = 0;
1038+
self.metrics.device_resets.inc();
10381039
Ok(())
10391040
}
10401041
}

src/vmm/src/devices/virtio/net/metrics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ pub struct NetDeviceMetrics {
150150
/// Number of times when interacting with the space config of a network device failed.
151151
pub cfg_fails: SharedIncMetric,
152152
/// Number of times the mac address was updated through the config space.
153+
/// Number of device resets.
154+
pub device_resets: SharedIncMetric,
153155
pub mac_address_updates: SharedIncMetric,
154156
/// No available buffer for the net device rx queue.
155157
pub no_rx_avail_buffer: SharedIncMetric,
@@ -222,6 +224,7 @@ impl NetDeviceMetrics {
222224
pub fn aggregate(&mut self, other: &Self) {
223225
self.activate_fails.add(other.activate_fails.fetch_diff());
224226
self.cfg_fails.add(other.cfg_fails.fetch_diff());
227+
self.device_resets.add(other.device_resets.fetch_diff());
225228
self.mac_address_updates
226229
.add(other.mac_address_updates.fetch_diff());
227230
self.no_rx_avail_buffer

0 commit comments

Comments
 (0)