pub trait Profiler {
// Required methods
fn start(&mut self);
fn end(&mut self);
}Expand description
An interface to profile iterator consumption/prodution performance
In real applications utilizing pipelining it’s important to measure the production and consumption rates of each pipeline step, to help identify current bottleneck.
ProfileEgress and ProfileIngress pinky-promise to
alway call start first, and then call corresponding end
before calling start again. The final end is not guaranteed
to be called (eg. if the inner iterator panicked), and in
particular the ProfileEgress will usually call the last
start with no-corresponding end, since it’s impossible to
predict if the next iterator chain step will call next()
again to pull for the next item.
See TotalTimeProfiler for simple starting built-in implementation.