cprofile模块的使用性能测试

python -m cProfile -s cumulative xxx.py

为了获得对 cProfile 结果的更多控制,我们可以生成一个统计文件然后通过 Python 进行分析:

$ python -m cProfile -o profile.stats xxx.py

我们可以这样将其调入 Python,它会输出跟之前一样的累计时间报告:

原文地址:https://www.cnblogs.com/wangdongpython/p/10995071.html