Expand description
Support for VM time.
This is a VM-specific timeline, which monotonically increases when and only when the VM is running. This module provides types used to access this time and to wait for it to reach target times. This can be used in device emulators to implement VM timers.
This is related to the idea of the hypervisor reference time, but it is not guaranteed to be the same value (and is likely not, except when the hypervisor reference time is emulated using VM time).
The root of VM time keeping is the VmTimeKeeper
. It manages a clock that
can be shared via use of VmTimeAccess
objects. Internally, this clock is
based on an offset from the OS’s monotonic clock while the VM is running, and
a fixed time when the VM is not running.
The infrastructure here supports access of VM time across multiple processes
in the same OS (but not across machines, virtual or physical). See the
comments on VmTimeSourceBuilder
for more information.
Structs§
- Saved
State - Saved state for
VmTimeKeeper
. - Time
Keeper IsGone - Error returned by
VmTimeSourceBuilder::build
when the time keeper has been torn down. - VmTime
- Roughly analogous to
std::time::Instant
, but for VM time. - VmTime
Access - An individual time accessor, used to query and wait for time.
- VmTime
Keeper - A time keeper, which tracks the current time and all waiters.
- VmTime
Source - A time source, used to instantiate
VmTimeAccess
. - VmTime
Source Builder - A time source builder, used to spawn tasks that back
VmTimeSource
instances. - VmTimer
Periodic - An abstraction over
VmTimeAccess
that streamlines the process of setting up a periodic timer.