Skip to main content

Instrument

Trait Instrument 

Source
pub trait Instrument {
    // Required methods
    fn name(&self) -> &'static str;
    fn on_operation_execution_cycle(
        &mut self,
        op: Operation,
        proc: Option<&str>,
    );
    fn write_report_to(&self, writer: &mut dyn Write) -> Result<()>;
}
Expand description

The functionality required for an instrument to be plugged in to Profiler.

Required Methods§

Source

fn name(&self) -> &'static str

The human readable name of this instrument used in CLI arguments and user output

This should be the same name as the corresponding InstrumentRegistration::NAME constant

Source

fn on_operation_execution_cycle(&mut self, op: Operation, proc: Option<&str>)

To be called each vm cycle an Operation is executed.

proc is the name of the most recent live procedure, or None when the operation cannot be attributed to a procedure. For example, it is None while executing a program without assembly operation metadata.

Source

fn write_report_to(&self, writer: &mut dyn Write) -> Result<()>

Write this instrumentation’s collected output as a report to writer

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§