pub struct Commpage { /* private fields */ }Expand description
Handle to a commpage backed by shared memory.
Implementations§
Source§impl Commpage
impl Commpage
Sourcepub fn create() -> Result<Self, CommpageError>
pub fn create() -> Result<Self, CommpageError>
Create a new commpage with a unique OS name. Initializes header and both cursors.
Sourcepub fn open(name: &str) -> Result<Self, CommpageError>
pub fn open(name: &str) -> Result<Self, CommpageError>
Open an existing commpage by its OS identifier. Validates magic and version.
Sourcepub fn set_cursor_value(&mut self, role: Role, sample_no: u64)
pub fn set_cursor_value(&mut self, role: Role, sample_no: u64)
Advance this role’s cursor after completing a sample.
Sourcepub fn wait_for_cursor_value(&self, role: Role, target: u64) -> bool
pub fn wait_for_cursor_value(&self, role: Role, target: u64) -> bool
Spin-wait until the peer’s cursor reaches at least target, or the peer sets DONE.
Returns true if the peer caught up, false if the peer exited early (DONE).
Sourcepub fn is_some_done(&self) -> bool
pub fn is_some_done(&self) -> bool
Either candidate or baseline has DONE bit set.
Sourcepub fn load_cursor_value(&self, role: Role) -> usize
pub fn load_cursor_value(&self, role: Role) -> usize
Read the sample counter for a given role (cursor value without the DONE bit). Sample counter is the number of a sample the children is collecting right now. 0 means that measurement has not start yet.
Sourcepub fn set_stop(&mut self)
pub fn set_stop(&mut self)
Set the STOP flag. Called by runner to signal time-budget exhaustion.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Check if the STOP flag is set.