parent
7acc347f8c
commit
9a5a0f2d43
@ -0,0 +1,17 @@
|
||||
import cProfile
|
||||
import pstats
|
||||
import 输出
|
||||
|
||||
profiler = cProfile.Profile()
|
||||
profiler.enable()
|
||||
|
||||
# 执行主函数
|
||||
输出.main()
|
||||
|
||||
profiler.disable()
|
||||
|
||||
# 输出性能分析结果到文本文件
|
||||
with open("profile_results.txt", "w") as f:
|
||||
ps = pstats.Stats(profiler, stream=f)
|
||||
ps.sort_stats('cumulative')
|
||||
ps.print_stats()
|
Loading…
Reference in new issue