Module vmcore::vmtime

source ·
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§