From 9a5a0f2d43fab8912690d747c61f1db6cbdb514e Mon Sep 17 00:00:00 2001 From: pg7s85mrc <3224571700@qq.com> Date: Wed, 18 Sep 2024 17:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test.py 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()