> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/debugging-tools-experience/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/debugging-tools-experience/chapter5-xiao-neng-fen-xi/63python-project/631cprofile-snakeviz.md).

# 6.4.1.cProfile, snakeviz

## 流程

* 1.將程式簡化成一個可以反覆執行的.py
* 2.以cProfile做效能分析(profiling), 找出程式裡的效能瓶頸處

```
python -m cProfile -o profile.stats -s cumulative testViewer.py
```

* 3.以snakeviz做進一步效能分析

```
snakeviz profile.stats
```
