Open DamienIrving opened 8 years ago
There are a number of different types of profiling:
If you want to move through your code step-by-step, use the Python debugger:
import pdb pdb.set_trace()
This depends if you're interested in runtime or memory usage...
Use cprofile to generate a binary file with the stats,
cprofile
$ python -m cprofile -o output.o script.py <args>
then you need a tool to visualise that binary file. There are lots out there (e.g. see this thread) - I found cprofilev to be simple and easy to use.
This thread goes through the options. The posts here and here are also good.
There are a number of different types of profiling:
Step-by-step
If you want to move through your code step-by-step, use the Python debugger:
Summary information
This depends if you're interested in runtime or memory usage...
Runtime
Use
cprofile
to generate a binary file with the stats,then you need a tool to visualise that binary file. There are lots out there (e.g. see this thread) - I found cprofilev to be simple and easy to use.
Memory usage
This thread goes through the options. The posts here and here are also good.