IPython magic for cProfile graphs w gprof2dot and graphviz in Jupyter/iterm。
profilegraph的Python项目详细描述
profilegraph
以图形形式显示cProfile
结果的行/单元格魔术。比如%time
或者%%time
,但是
有更多的信息(包括你期望的性能损失
cProfile.run
)。在
灵感来自 mattijn/gprof2dot_magic。在
安装
这个包需要安装带有python内核的Jupyter。唯一的
其他python依赖关系是
^{cProfile
输出到graphviz
兼容的点文件,由pip安装
自动生成一个^{
pip install profilegraph
使用
在Jupyter笔记本中加载扩展:
^{pr2}$通过在开头粘贴%profilegraph
来分析一行代码:
importre%profilegraphre.sub("biz","baz","foobarbiz")
如果你有一个需要分析的整个细胞,你可以使用细胞魔术 形式:
%%profilegraphforiinrange(10):print(i)
发展
profilegraph
使用^{flit
与{
以可编辑模式安装:
flit install [--symlink][--python path/to/python]
上载到PyPI时使用:
flit publish
- 项目
标签: