Skip to content

Commit

Permalink
Use BootTimer to measure hotplug latency
Browse files Browse the repository at this point in the history
Change the boot timer timestamp to be public, so that the timer can also
be used for measuring hotplugging

Signed-off-by: James Curtis <[email protected]>
  • Loading branch information
JamesC1305 committed Aug 19, 2024
1 parent e6c2c93 commit bb9cb56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vmm/src/devices/pseudo/boot_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const MAGIC_VALUE_SIGNAL_GUEST_BOOT_COMPLETE: u8 = 123;
/// Pseudo device to record the kernel boot time.
#[derive(Debug)]
pub struct BootTimer {
start_ts: TimestampUs,
pub start_ts: TimestampUs,
}

impl BootTimer {
Expand Down
8 changes: 8 additions & 0 deletions src/vmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,14 @@ impl Vmm {

self.acpi_device_manager.notify_cpu_container()?;

#[cfg(test)]
if let Some(devices::BusDevice::BootTimer(timer)) =
self.get_bus_device(DeviceType::BootTimer, "BootTimer")
{
let mut locked_timer = timer.lock().expect("Poisoned lock");
locked_timer.start_ts = utils::time::TimestampUs::default();
}

Ok(new_machine_config)
}

Expand Down

0 comments on commit bb9cb56

Please sign in to comment.