Skip to content

Commit bb9cb56

Browse files
committed
Use BootTimer to measure hotplug latency
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]>
1 parent e6c2c93 commit bb9cb56

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/vmm/src/devices/pseudo/boot_timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const MAGIC_VALUE_SIGNAL_GUEST_BOOT_COMPLETE: u8 = 123;
1010
/// Pseudo device to record the kernel boot time.
1111
#[derive(Debug)]
1212
pub struct BootTimer {
13-
start_ts: TimestampUs,
13+
pub start_ts: TimestampUs,
1414
}
1515

1616
impl BootTimer {

src/vmm/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,14 @@ impl Vmm {
689689

690690
self.acpi_device_manager.notify_cpu_container()?;
691691

692+
#[cfg(test)]
693+
if let Some(devices::BusDevice::BootTimer(timer)) =
694+
self.get_bus_device(DeviceType::BootTimer, "BootTimer")
695+
{
696+
let mut locked_timer = timer.lock().expect("Poisoned lock");
697+
locked_timer.start_ts = utils::time::TimestampUs::default();
698+
}
699+
692700
Ok(new_machine_config)
693701
}
694702

0 commit comments

Comments
 (0)