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))





免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM