pub struct GlobalState { /* private fields */ }Expand description
Global state associated with the detcore tool.
This is a singleton, and the one object of this type lives inside a central address space, generally the “tracer” in a Reverie backend.
Implementations§
Source§impl GlobalState
impl GlobalState
Sourcepub fn mount_identity_provenance(
&self,
) -> Result<Option<MountIdentityProvenance>, &'static str>
pub fn mount_identity_provenance( &self, ) -> Result<Option<MountIdentityProvenance>, &'static str>
Return the producer-observed mount identity order after a run.
The first vector is the exact mountinfo row/parent order. The second is the first-observation order of raw fdinfo IDs absent from that table.
Sourcepub fn init_for_external_scheduler(cfg: &Config) -> Self
pub fn init_for_external_scheduler(cfg: &Config) -> Self
Initializes global state whose sequential scheduler is driven by an external backend executor.
Sourcepub fn run_external_scheduler(
&self,
observer: Arc<dyn Fn(&'static str) + Send + Sync>,
) -> impl Future<Output = ()> + use<>
pub fn run_external_scheduler( &self, observer: Arc<dyn Fn(&'static str) + Send + Sync>, ) -> impl Future<Output = ()> + use<>
Returns the sequential scheduler loop for a backend-owned executor to run.
This is deliberately not an async fn: the announcement is logged when
this is called, not when the returned future is first polled. A backend
can then order it ahead of anything it releases before polling (DBT
publishes READY_IMAGE, which lets the root guest thread log its
seeding lines). See https://github.com/rrnewton/hermit/issues/3463.
Sourcepub fn complete_physical_process_exit(&self, raw_pid: i32)
pub fn complete_physical_process_exit(&self, raw_pid: i32)
Reports that a backend supervisor received a process’s final kernel exit status.
This only records a barrier observation when the backend advertises physical-exit reporting; it is therefore a no-op for ptrace, DBT, KVM, and LiteInst execution. The exact process’s barrier is released at this physical-waitability boundary.
Sourcepub fn release_all_physical_process_exits(&self)
pub fn release_all_physical_process_exits(&self)
Releases all physical-process-exit barriers after a backend supervisor has drained every tracee and no guest thread can race another lifecycle event.
Sourcepub fn force_shutdown_with_error(&self)
pub fn force_shutdown_with_error(&self)
Unrecoverable fatal erorr. Bring things to a close cleanly, but as quickly as possible.
Sourcepub async fn cancel_internal_scheduler(&mut self)
pub async fn cancel_internal_scheduler(&mut self)
Cancels the internally spawned scheduler task after a backend guest exits abnormally.
External-scheduler states do not own a task and are left unchanged.
Sourcepub async fn clean_up_after_backend_failure(self) -> BackendFailureCleanup
pub async fn clean_up_after_backend_failure(self) -> BackendFailureCleanup
Consume failed-run state after the scheduler has naturally finished.
A failed run has no successful run summary. Preserve the scheduler’s join error and any requested partial preemption recording’s write error for the caller, without allowing either to replace the backend failure.
Sourcepub async fn clean_up(
self,
to_stderr: bool,
print_summary_to_json_file: &Option<PathBuf>,
)
pub async fn clean_up( self, to_stderr: bool, print_summary_to_json_file: &Option<PathBuf>, )
Shut down anything running, in particular wait on the scheduler.
This is basically the destructor for the global state, but is here rather than in the Drop instance so that it can be async, and is more explicitly sequenced in the program.
Print a summary of the execution, typically called when it is complete.
If the boolean argument is true, print to stderr, otherwise only print the summary to the log.
Sourcepub async fn clean_up_with_dispatch_stats(
self,
to_stderr: bool,
print_summary_to_json_file: &Option<PathBuf>,
dispatch_stats: Option<DispatchStats>,
)
pub async fn clean_up_with_dispatch_stats( self, to_stderr: bool, print_summary_to_json_file: &Option<PathBuf>, dispatch_stats: Option<DispatchStats>, )
Self::clean_up, also carrying the backend’s dispatch record into the
machine-readable summary. The human-readable report, including the INFO
view --verify compares, never shows it.
Trait Implementations§
Source§impl Debug for GlobalState
impl Debug for GlobalState
Source§impl Default for GlobalState
impl Default for GlobalState
Source§impl Drop for GlobalState
impl Drop for GlobalState
Source§impl GlobalTool for GlobalState
impl GlobalTool for GlobalState
Source§type Request = (DetTime, MmId, GlobalRequest)
type Request = (DetTime, MmId, GlobalRequest)
A request asks the scheduler to perform an RPC, which includes multiple kinds of actions, and, most importantly, permission to acquire resources and run the guest thread.
Irrespective of which method we execute, we can “tick” our local component of the global time in the process.
Source§type Response = (Option<LogicalTime>, GlobalResponse)
type Response = (Option<LogicalTime>, GlobalResponse)
Response from the global portion of the Detcore instrumentation tool. The exact form of the response depends on which method was executed.
Irrespective of which method was called, the global handling may have consumed
logical time, in which case the scheduler can send a new thread-local time back to
the caller. Unfortunately, information is lost as this is collapsed to a flat
scalar instead of a rich DetTime.
Source§fn init_global_state<'life0, 'async_trait>(
cfg: &'life0 Config,
) -> Pin<Box<dyn Future<Output = GlobalState> + Send + 'async_trait>>where
'life0: 'async_trait,
fn init_global_state<'life0, 'async_trait>(
cfg: &'life0 Config,
) -> Pin<Box<dyn Future<Output = GlobalState> + Send + 'async_trait>>where
'life0: 'async_trait,
Called once during startup.
Source§type Config = Config
type Config = Config
Source§fn install_backend_signal_control(
&self,
control: Option<BackendSignalControl>,
) -> Result<BackendSignalControlMode, Error>
fn install_backend_signal_control( &self, control: Option<BackendSignalControl>, ) -> Result<BackendSignalControlMode, Error>
Source§fn on_backend_signal_boundary<'life0, 'async_trait>(
&'life0 self,
receipt: SignalBoundaryReceipt,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_backend_signal_boundary<'life0, 'async_trait>(
&'life0 self,
receipt: SignalBoundaryReceipt,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn on_backend_process_retired(
&self,
event: BackendProcessRetirement,
) -> Result<(), Error>
fn on_backend_process_retired( &self, event: BackendProcessRetirement, ) -> Result<(), Error>
BackendSignalControl sends this callback. A
Tool may retain a fence awaiting it only with that capability installed
in ToolControlled mode; a backend offering that mode must complete the
callback after successful process retirement. A terminal boundary receipt
can establish this fence and must remain able to cancel peer RPCs.
The fence then keeps other processes from observing host-timed EOF. Read moreSource§fn report_backend_failure(&self, event: BackendFailure)
fn report_backend_failure(&self, event: BackendFailure)
Source§fn wait_for_backend_failure<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_for_backend_failure<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
receive_rpc, and proceed to consuming exit hooks. Shared state must
already support that cleanup; returning is not an ordinary RPC reply.
The ptrace backend polls the returned future again only after the waker
it was last polled with fires, so a pending future must arrange that
wake rather than rely on being polled again for another reason.Source§fn on_backend_child_wait_event<'life0, 'async_trait>(
&'life0 self,
event: BackendChildWaitEvent,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_backend_child_wait_event<'life0, 'async_trait>(
&'life0 self,
event: BackendChildWaitEvent,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn receive_rpc<'life0, 'async_trait>(
&'life0 self,
from: Tid,
gr: Self::Request,
) -> Pin<Box<dyn Future<Output = Self::Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive_rpc<'life0, 'async_trait>(
&'life0 self,
from: Tid,
gr: Self::Request,
) -> Pin<Box<dyn Future<Output = Self::Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for GlobalState
impl RefUnwindSafe for GlobalState
impl Send for GlobalState
impl Sync for GlobalState
impl Unpin for GlobalState
impl UnsafeUnpin for GlobalState
impl UnwindSafe for GlobalState
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> FmtForward for T
impl<T> FmtForward for T
Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§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 moreSource§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 moreSource§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
Source§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
Source§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.Source§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.Source§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.Source§impl<T> Tap for T
impl<T> Tap for T
Source§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.