Coro code profiler.
This profiler is coro-aware. It produces output to a binary file on disk. You then use the coro.print_profile module to convert it to an HTML file.
There are two ways to run the profiler. One is to use the coro.profiler.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 coro.profiler.start() to start the profiler and coro.profiler.stop() when you want to stop profiling. This can be conveniently done from the backdoor.
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.
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.
Start the profiler on a function.
This will start the profiler, and then call the provided function. The profiler will shut down once the function returns.
Additional arguments provided are passed to the function.
This will display the results to stdout after the function is finished.
Parameters: |
|
---|
Start the profiler.
Parameters : |
|
---|
Stop the profiler.
Parameters : |
|
---|