Function count_instructions::count_instructions
source · pub fn count_instructions<F, T, C>(f: F, counter: C) -> Result<T>where
F: FnOnce() -> T,
C: FnMut(&Instruction) + Send,
Expand description
Runs the function being tested, calling a counter function for each instruction executed.
The counter
will be called once for each instruction executed while running f
. Note that
counter
might be called a few more times, immediately before and after running f
, due to a
few extra instructions necessary to start the trace, copy the result, and stop the trace.
See the top-level crate documentation for examples.