Skip to content

Commit

Permalink
feat(vhost-user-blk): added config_change_time_us metric
Browse files Browse the repository at this point in the history
Added `config_change_time_us` metric to the vhost-user-block device.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
  • Loading branch information
ShadowCurse committed Nov 23, 2023
1 parent 854cced commit a605fa7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vmm/src/devices/virtio/vhost_user_block/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ impl<T: VhostUserHandleBackend> VhostUserBlockImpl<T> {
}

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
Expand All @@ -273,6 +275,9 @@ impl<T: VhostUserHandleBackend> VhostUserBlockImpl<T> {
.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(())
}
}
Expand Down

0 comments on commit a605fa7

Please sign in to comment.