Trait embedded_profiling::EmbeddedProfiler [−][src]
pub trait EmbeddedProfiler {
fn read_clock(&self) -> EPInstant;
fn log_snapshot(&self, _snapshot: &EPSnapshot) { ... }
fn at_start(&self) { ... }
fn at_end(&self) { ... }
fn start_snapshot(&self) -> EPInstant { ... }
fn end_snapshot(
&self,
start: EPInstant,
name: &'static str
) -> Option<EPSnapshot> { ... }
}Expand description
The main trait to implement. All that is required is a way to read time and a way to output our results, if desired. You can also implement functions that get called when a snapshot starts and ends.
Required methods
fn read_clock(&self) -> EPInstant
fn read_clock(&self) -> EPInstant
Takes a reading from the clock
Provided methods
fn log_snapshot(&self, _snapshot: &EPSnapshot)
fn log_snapshot(&self, _snapshot: &EPSnapshot)
Optionally log the snapshot to some output, like a serial port
Optional function that gets called at the start of the snapshot recording.
If one would want to very simple profiling, they could use at_start and at_end
to simply toggle a GPIO.
fn start_snapshot(&self) -> EPInstant
fn start_snapshot(&self) -> EPInstant
takes the starting snapshot of a specific trace
fn end_snapshot(
&self,
start: EPInstant,
name: &'static str
) -> Option<EPSnapshot>
fn end_snapshot(
&self,
start: EPInstant,
name: &'static str
) -> Option<EPSnapshot>
computes the duration of the snapshot given the start time, if there hasn’t been overflow
