pub struct Session { /* private fields */ }Expand description
A tracing session: options, output directory, and the state all vCPUs share (breakpoints, global sequence, statistics).
Session is cheap to clone; clones refer to the same session.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(
opts: TraceOptions,
mem: Arc<dyn GuestMemory>,
out: Option<&Path>,
) -> Result<Session>
pub fn new( opts: TraceOptions, mem: Arc<dyn GuestMemory>, out: Option<&Path>, ) -> Result<Session>
Starts a session writing into directory out (created if needed).
Pass None to keep records in memory only (use
Session::vcpu_with_sink).
Sourcepub fn options(&self) -> &TraceOptions
pub fn options(&self) -> &TraceOptions
The options.
Sourcepub fn memory(&self) -> &Arc<dyn GuestMemory> ⓘ
pub fn memory(&self) -> &Arc<dyn GuestMemory> ⓘ
Guest memory.
Sourcepub fn vcpu(&self, id: u32) -> Result<VcpuTracer>
pub fn vcpu(&self, id: u32) -> Result<VcpuTracer>
A tracer for vCPU id, writing to the session’s output directory.
Sourcepub fn vcpu_with_sink(&self, id: u32, sink: Box<dyn TraceSink>) -> VcpuTracer
pub fn vcpu_with_sink(&self, id: u32, sink: Box<dyn TraceSink>) -> VcpuTracer
A tracer for vCPU id that hands its records to sink.
Sourcepub fn token(&self) -> Option<Token>
pub fn token(&self) -> Option<Token>
In Ordering::Serialized mode, the token a vCPU must hold while
it executes a step. None in concurrent mode.
The token is handed out first-come, first-served (a ticket lock), so runnable vCPUs take turns one instruction at a time. An unfair lock would let one vCPU run thousands of instructions while the others wait, which is a correct order but a badly distorted one.
Sourcepub fn budget_exhausted(&self) -> bool
pub fn budget_exhausted(&self) -> bool
Has the instruction budget run out?
Sourcepub fn finish(&self) -> Result<Stats>
pub fn finish(&self) -> Result<Stats>
Removes all breakpoints from guest memory and writes the MacSim header and a summary. Call once, after every vCPU tracer has been finished.
Sourcepub fn remove_breakpoints(&self)
pub fn remove_breakpoints(&self)
Removes the entry-point breakpoints (also done by Session::finish).
Sourcepub fn is_entry_breakpoint(&self, state: &CpuState) -> bool
pub fn is_entry_breakpoint(&self, state: &CpuState) -> bool
Is state stopped on one of the session’s entry breakpoints?