Skip to content
API REFERENCEUsage guides →

cellpack::prof::Profiler ​

trait

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 ​

const ENABLED: bool

Whether this instantiation times anything; false lets a caller skip the hooks entirely, so the untimed code has no clock reads.

Stamp ​

type Stamp: Copy

What a site’s start returns: a clock reading, or () for Off.

on ​

fn on(&self, site: Site) -> bool

Whether site records; constant false for Off.

start ​

fn start(&self, site: Site) -> Self::Stamp

The clock if site records, else an empty stamp.

stop ​

fn stop(&mut self, site: Site, at: Self::Stamp)

One call of site since at; nothing for an empty stamp.

stop_at ​

fn stop_at(&mut self, site: Site, key: usize, at: Self::Stamp)

As Self::stop, into detail slot key of the site.

add_ticks ​

fn add_ticks(&mut self, site: Site, ticks: u64)

Adds ticks already measured to site (one call).

since ​

fn since(&self, at: Self::Stamp) -> u64

The ticks from at to now (0 for an empty stamp).

record ​

fn record(&self) -> Option<&Record>

The thread’s records, if it keeps any.

mark ​

fn mark(&self, site: Site) -> u64

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) -> Self

A fresh profiler with the same sites, for another thread.

setup ​

fn setup(&self) -> Option<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.

Definition