pyton性能分析器——pyinstrument

Posted 纪宇-年华

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pyton性能分析器——pyinstrument相关的知识,希望对你有一定的参考价值。

pyinstrument会把代码里运行耗时的部分给你找出来

  • 使用

pip install pyinstrument

import time
from pyinstrument import Profiler

def sleep_time():
    time.sleep(2)
    print(\'end\')


profiler = Profiler()
profiler.start()

"""
要运行的内容
"""
sleep_time()

profiler.stop()
print(profiler.output_text(unicode=True, color=True))







路漫漫其修远兮,吾将上下而求索

本文来自博客园,作者:纪宇-年华,转载请注明原文链接:https://www.cnblogs.com/jiyu-hlzy/p/15313222.html

以上是关于pyton性能分析器——pyinstrument的主要内容,如果未能解决你的问题,请参考以下文章