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 for
VmTimeKeeper
. - Error returned by
VmTimeSourceBuilder::build
when the time keeper has been torn down. - Roughly analogous to
std::time::Instant
, but for VM time. - An individual time accessor, used to query and wait for time.
- A time keeper, which tracks the current time and all waiters.
- A time source, used to instantiate
VmTimeAccess
. - A time source builder, used to spawn tasks that back
VmTimeSource
instances. - An abstraction over
VmTimeAccess
that streamlines the process of setting up a periodic timer.