diff --git a/test.py b/test.py new file mode 100644 index 0000000..437799f --- /dev/null +++ b/test.py @@ -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()