用于粒度分析和实时分析的工具集
pyrofiler的Python项目详细描述
高温过滤器
用于细粒度内存和cpu实时评测的工具集
快速启动
度量执行时间的Contextmanager
# examples/simple_profile.pyimportpyrofilerimporttimewithpyrofiler.timing('Time elapsed'):time.sleep(1)^{pr2}$
用于分析函数的装饰器
# examples/simple_profile_cpu.pyimportpyrofiler@pyrofiler.cpu_util(description='Cpu usage')@pyrofiler.timed('Time elapsed')defsum_series(x,N):returnsum([x**i/iforiinrange(1,N)])sum_series(.3,1000_000)
$ python simple_profile_cpu.py Time elapsed : 0.13478374481201172 Cpu usage : 29.4
在公共上下文中聚合结果:
# examples/profile_with_context.pyfrompyrofilerimportProfilerimporttimeprof=Profiler()withprof.timing('Time 1'):time.sleep(1)withprof.timing('Time 2'):time.sleep(1.5)print('Profiling data recorded:')print(prof.data)
$ python profile_with_context.py Time 1 : 1.0011215209960938 Time 2 : 1.5020403861999512 Profiling data recorded: {'Time 1': 1.0011215209960938, 'Time 2': 1.5020403861999512}
您可以使用其他操作,例如将结果附加到数据中的某个列表。 检查documentation以了解更多用例
问题
{/strong}但您没有一个粒度为{/str}的api文件,而不是一个用于
或者你有像decorators和no memory profiling
有一个实时的仪表板也会有帮助,为此使用https://github.com/libvis
特点
- 托多
学分
此包是用Cookiecutter和audreyr/cookiecutter-pypackage项目模板创建的。在
历史
- PyPI的第一个版本。在
- 项目
标签: