Python profile & Time Analysis
```bash
python -m cProfile myscript.py
python -m profile myscript.py
```
```python
import cProfile, pstats
pr = cProfile.Profile()
pr.enable()
###################Your Code or Function Here
pr.disable()
ps = pstats.Stats(pr).strip_dirs().sort_stats('cumulative')
ps.print_callees()
python -m cProfile myscript.py
python -m profile myscript.py
```
```python
import cProfile, pstats
pr = cProfile.Profile()
pr.enable()
###################Your Code or Function Here
pr.disable()
ps = pstats.Stats(pr).strip_dirs().sort_stats('cumulative')
ps.print_callees()
```
评论
发表评论