【发布时间】:2015-06-20 06:13:30
【问题描述】:
我基本上做了以下事情:
import cProfile, pstats, StringIO
pr = cProfile.Profile()
pr.enable()
# ... my code did something ...
pr.disable()
s = StringIO.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.dump_stats('stats.dmp') # dump the stats to a file named stats.dmp
所以现在我已经离线存储了名为“stats.dmp”的文件。
如何使用 pstats 分析此文件以供人类使用?
提前致谢。
【问题讨论】:
标签: python profiling analysis pstats