You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
345 B

2 months ago
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()