Peach Profiler 🍑 is a performant, low-overhead profiler. It's just peachy.
Peach Profiler in action
use ;
// Add the `time_main` macro to the main function
// Time a function
---------- Outputs ----------
28657
______________________________________________________
Total time: 1.7490ms (CPU freq 4300860492)
answer_block[1]: 6665, (0.09%, 99.63% w/children)
fibonacci[57313]: 7487891, (99.54%)
To Use
The Peach Profiler will only add the instrumentation needed to profile and
output performance metrics if the profile feature is enabled. Without it just
the Total time will be shown if main is marked with #[time_main].
Either add the profile feature with the dependancy in the Cargo.toml file, i.e.:
[]
= { = "0.1", = ["profile"]}
to always profile your code.
Or add a feature to your crate in the Cargo.toml file, i.e.:
[]
= ["peach_profiler/profile"]
And then instrumentation will only be added when your program is run with the
feature specified, i.e. cargo r --features=profile
Run in a no_std env by disabling default features:
[]
= { = "0.1", = false }
Debugging
If you are missing a timed function or block from the output there could be the potential for hash collisions that aren't checked for in the default execution. Running Peach Profiler with the debug feature will panic with collision information if one is found.