Coro code profiler.
Using The Profiler
There are two ways to run the profiler. One is to use the go function where
you give it a python function to run. Profiling will start and call the
function, and then the profiler will automatically stop when the function
exits.
The other method is to call start to start the profiler and stop when you
want to stop profiling. This can be conveniently done from the backdoor.
Rendering Output
Once you have profiler output, you must use the print_profile module
to convert it to HTML. The typical method for doing this is:
python -m coro.print_profile /tmp/coro_profile.bin > my_profile.html
Then view the profile output in your web browser.
Profiler Types
The profiler supports different ways of gathering statistics. This is done by
specifying the "bench" object to use (see go and start). They default to
the "rusage" method of gathering statistics about every function call (see the
getrusage man page for more detail). If you want a higher performance profile,
you can use the coro.bench object instead which simply records TSC values for
every function call. If you want to define your own method of gathering
statistics, subclass coro.bench and implement your own techniques.