bos/statprof.py — pull request #16 by nvie (2013-09-04 07:35:53+00:00)
Title: Add ability to run statprof as a module

This supports the following usage pattern, similar to other profiling tools, or pdb:

$ python -m statprof myscript.py

time seconds seconds name
93.67 0.20 0.20 myscript.py:8:main
2.53 0.01 0.01 myscript.py:7:main
1.90 0.00 0.00 myscript.py:9:main
1.27 0.00 0.00 myscript.py:6:main
0.63 0.00 0.00 myscript.py:10:main
0.00 0.21 0.00 runpy.py:162:_run_module_as_main
0.00 0.21 0.00 myscript.py:18:
0.00 0.21 0.00 statprof.py:471:
0.00 0.21 0.00 runpy.py:72:_run_code
0.00 0.21 0.00 statprof.py:468:main
---
Sample count: 158
Total time: 0.210000 seconds