diff --git a/src/vmm/src/devices/virtio/vhost_user_block/device.rs b/src/vmm/src/devices/virtio/vhost_user_block/device.rs index 7293dace3879..588b7f8c5f7e 100644 --- a/src/vmm/src/devices/virtio/vhost_user_block/device.rs +++ b/src/vmm/src/devices/virtio/vhost_user_block/device.rs @@ -256,6 +256,8 @@ impl VhostUserBlockImpl { } pub fn config_update(&mut self) -> Result<(), VhostUserBlockError> { + let start_time = utils::time::get_time_us(utils::time::ClockType::Monotonic); + // This buffer is used for config size check in vhost crate. let buffer = [0u8; BLOCK_CONFIG_SPACE_SIZE as usize]; let (_, new_config_space) = self @@ -273,6 +275,9 @@ impl VhostUserBlockImpl { .trigger_irq(IrqType::Config) .map_err(VhostUserBlockError::IrqTrigger)?; + let delta_us = utils::time::get_time_us(utils::time::ClockType::Monotonic) - start_time; + self.metrics.config_change_time_us.store(delta_us); + Ok(()) } }