pub struct GlobalTime { /* private fields */ }Expand description
Deterministic global time, combining local times.
Implementations§
Source§impl GlobalTime
impl GlobalTime
Sourcepub fn update_global_time(
&mut self,
tid: DetTid,
newtime: LogicalTime,
inherited: LogicalDuration,
)
pub fn update_global_time( &mut self, tid: DetTid, newtime: LogicalTime, inherited: LogicalDuration, )
Tick the time of a particular thread.
Sourcepub fn add_scheduler_time(&mut self) -> Result<LogicalTime, ClockExhausted>
pub fn add_scheduler_time(&mut self) -> Result<LogicalTime, ClockExhausted>
Add time that passage is not driven by the internal events within guest threads. This is effectively used to account for “time” consumed by the scheduler, and to ensure monotonic increase of global time while scheduling.
With a configured --scheduler-turn-cost, a turn whose charge would
pass the end of representable time is refused with
ClockExhausted and adds nothing: a saturated clock would let later
turns advance nothing while the run went on. The scheduler turns the
error into a fatal exit. Without the option the default charge
saturates, as it always did, and this never fails.
Sourcepub fn add_capped_scheduler_time(
&mut self,
cap: u64,
) -> Result<LogicalTime, ClockExhausted>
pub fn add_capped_scheduler_time( &mut self, cap: u64, ) -> Result<LogicalTime, ClockExhausted>
Self::add_scheduler_time for a turn charged at most cap
nanoseconds: the scheduler’s charge for a turn that ends a timeslice
under --cap-preemption-charge, whose cap is the virtual time the
thread ran since its previous turn. The capped charge is at least one
nanosecond, so the turn still advances the clock, as a configured
--scheduler-turn-cost must (Config::scheduler_turn_charge); a
default charge that the clock multiplier truncates to zero stays zero,
as it always was. A cap at or above the turn’s charge changes
nothing.
Sourcepub fn add_extra_time(&mut self, delta: Duration) -> LogicalTime
pub fn add_extra_time(&mut self, delta: Duration) -> LogicalTime
Update the global clock to account for time not driven by internal within guest threads. This is a central or external expenditure of time, rather than a thread-internal one.
The argument is in nanosecods and should have had any clock multiplier applied alreday.
Sourcepub fn threads_time(&self, dtid: DetTid) -> LogicalTime
pub fn threads_time(&self, dtid: DetTid) -> LogicalTime
Project a thread’s absolute local clock, including its inherited history and the epoch. Exec recovery and scheduler replay use this projection.
Sourcepub fn contains_thread(&self, dtid: DetTid) -> bool
pub fn contains_thread(&self, dtid: DetTid) -> bool
Returns whether this clock has observed work from a thread.
Sourcepub fn reassign_thread(&mut self, from: DetTid, to: DetTid)
pub fn reassign_thread(&mut self, from: DetTid, to: DetTid)
Move a surviving thread’s clock component to the process-leader TID installed by Linux after a non-leader thread successfully execs.
Work previously performed by the old leader remains part of aggregate time, but no longer belongs to the new image’s local thread clock.
Sourcepub fn retire_thread(&mut self, dtid: DetTid)
pub fn retire_thread(&mut self, dtid: DetTid)
Drop the clock component of a thread that is gone, keeping its own work in aggregate time. A later thread that Linux gives the same ID then starts a component of its own, with its own inherited baseline, instead of continuing the old thread’s clock.
Sourcepub fn threads_inherited_time(&self, dtid: DetTid) -> LogicalTime
pub fn threads_inherited_time(&self, dtid: DetTid) -> LogicalTime
The absolute clock inherited when this thread started. Its first report can arrive after scheduler registration; work since startup is the current thread clock minus this baseline, not minus the epoch.
Sourcepub fn threads_duration(&self, dtid: DetTid) -> LogicalDuration
pub fn threads_duration(&self, dtid: DetTid) -> LogicalDuration
Project a thread’s local duration, including inherited history but excluding the epoch. This is the duration used by scheduler replay; aggregate time separately excludes the inherited part.
Sourcepub fn as_nanos(&self) -> LogicalTime
pub fn as_nanos(&self) -> LogicalTime
Deterministic lower bound on the amount of work that has happened across all threads, starting with the same epoch time as individual thread clocks.
This roughly models something like real time if all threads were running on one core.
Sourcepub fn elapsed_nanos(&self) -> Option<LogicalDuration>
pub fn elapsed_nanos(&self) -> Option<LogicalDuration>
Elapsed virtual time in the same precision domain as this clock’s
baseline. DetTime stores the epoch at microsecond precision, so
subtracting the original nanosecond DateTime can underflow for an
otherwise empty run whose epoch has a sub-microsecond component.
Global time never falls behind its own baseline; None reports that
broken invariant in every build profile instead of wrapping in release.
Trait Implementations§
Source§impl Clone for GlobalTime
impl Clone for GlobalTime
Source§fn clone(&self) -> GlobalTime
fn clone(&self) -> GlobalTime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GlobalTime
impl Debug for GlobalTime
Source§impl Default for GlobalTime
impl Default for GlobalTime
Source§fn default() -> GlobalTime
fn default() -> GlobalTime
Source§impl<'de> Deserialize<'de> for GlobalTime
impl<'de> Deserialize<'de> for GlobalTime
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GlobalTime
impl RefUnwindSafe for GlobalTime
impl Send for GlobalTime
impl Sync for GlobalTime
impl Unpin for GlobalTime
impl UnsafeUnpin for GlobalTime
impl UnwindSafe for GlobalTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.