Skip to main content

Module profile

Module profile 

Source
Expand description

Traces for psync-predict, from functions annotated #[psync::graph(profile)].

Such a function runs as written, and reports every statement that awaits: its source line and how long it took, by the clock you install. Install a clock and a sink once, before the run:

β“˜
fn clock() -> u64 { /* microseconds since some start */ }
fn sink(line: usize, cost: u64) { println!("{line} {cost}") }
psync::profile::install(clock, sink);

Without them, profiled statements report nothing. A statement left by ?, return or break reports nothing either, so trace a run that does not take an early exit.

StaticsΒ§

CLOCK πŸ”’
SINK πŸ”’

FunctionsΒ§

install
Use clock to time profiled statements and sink to receive each one’s (line, cost).
now πŸ”’
record πŸ”’