Appearance
cellpack::prof::Profiler
Module contract · All interfaces
At a glance
pub trait Profiler: Send + Sync {
type Stamp: Copy;
const ENABLED: bool;
// Required methods
fn on(&self, site: Site) -> bool;
fn start(&self, site: Site) -> Self::Stamp;
fn stop(&mut self, site: Site, at: Self::Stamp);
fn stop_at(&mut self, site: Site, key: usize, at: Self::Stamp);
fn add_ticks(&mut self, site: Site, ticks: u64);
fn since(&self, at: Self::Stamp) -> u64;
fn record(&self) -> Option<&Record>;
fn mark(&self, site: Site) -> u64;
fn since_mark(&mut self, site: Site, mark: u64);
fn fork(&self) -> Self;
fn setup(&self) -> Option<Setup>;
}Timing hooks; see the module documentation.
Member index
13 of 13 members
ENABLEDWhether this instantiation times anything; false lets a caller skip the hooks entirely, so the untimed code has no clock reads.StampWhat a site’s start returns: a clock reading, or () for Off .onWhether site records; constant false for Off .startThe clock if site records, else an empty stamp.stopOne call of site since at ; nothing for an empty stamp.stop_atAs Self::stop , into detail slot key of the site.add_ticksAdds ticks already measured to site (one call).sinceThe ticks from at to now (0 for an empty stamp).recordThe thread’s records, if it keeps any.markA raw clock reading if site records, else 0: a stamp to keep across calls (a read’s submission, say).since_markOne call of site since a Self::mark ; nothing for 0.forkA fresh profiler with the same sites, for another thread.setupWhat turns records into a report; none for Off .
Methods and associated constants
ENABLED
Whether this instantiation times anything; false lets a caller skip the hooks entirely, so the untimed code has no clock reads.
Stamp
What a site’s start returns: a clock reading, or () for Off.
on
Whether site records; constant false for Off.
start
The clock if site records, else an empty stamp.
stop
One call of site since at; nothing for an empty stamp.
stop_at
As Self::stop, into detail slot key of the site.
add_ticks
Adds ticks already measured to site (one call).
since
The ticks from at to now (0 for an empty stamp).
record
The thread’s records, if it keeps any.
mark
A raw clock reading if site records, else 0: a stamp to keep across calls (a read’s submission, say).
since_mark
fn since_mark(&mut self, site: Site, mark: u64)One call of site since a Self::mark; nothing for 0.
fork
fn fork(&self) -> SelfA fresh profiler with the same sites, for another thread.
setup
What turns records into a report; none for Off.
Contract reference
See the module reference for semantic input/output rules, units, allocation, mutation, failure behavior, and lifetime requirements. Declarations and documented members are synchronized from the crate source.