2024-09-20 23:04:25 发布
网友
nosetest --with-profile --profile-stats-file output
runsnake无法读取输出,因为nosetest使用hotshot,如果要生成一个可以用runsnake读取的文件,需要将其转换为:
st = hotshot.stats.load('output')st.dump_stats('output_new')
st = hotshot.stats.load('output')
st.dump_stats('output_new')
我可以用cProfile直接用runsnake运行这个测试吗?在
@cihanpesend的回答对我来说不太管用(cProfile找不到“nosetests”),但我确实在Linux上成功地使用了:
python -m cProfile -o profile.out `which nosetests` .
结果输出在runsnake中运行良好。在
(大概在Windows上,您可以将which nosetests替换为noestests顶级python脚本的硬编码路径。)
which nosetests
我认为nosetests的hotshot profiler的输出与runsnake不兼容。当然,这两个也不太适合我。在
除了python项目,我没有关于nosetest的信息。所以
python -m cProfile -o outputfile nosetest
然后
RunSnakeRun对于可视化profiler非常有用。在
注意:要运行runsnake,必须安装wx和numpy。在
runsnake
从pythomin的输出不能更新。(我没试过)
根据@squid的答案,您可以使用一个名为^{}的nose插件,用cProfile替换nose默认的profiler hotshot。在
要安装它:
pip install nose-cprof
然后这样叫鼻子:
它应该生成一个cProfile输出文件,然后您可以使用runsnakerun等工具对其进行分析。在
runsnakerun
@cihanpesend的回答对我来说不太管用(cProfile找不到“nosetests”),但我确实在Linux上成功地使用了:
结果输出在runsnake中运行良好。在
(大概在Windows上,您可以将
which nosetests
替换为noestests顶级python脚本的硬编码路径。)我认为nosetests的hotshot profiler的输出与runsnake不兼容。当然,这两个也不太适合我。在
除了python项目,我没有关于nosetest的信息。所以
然后
^{pr2}$RunSnakeRun对于可视化profiler非常有用。在
注意:要运行
runsnake
,必须安装wx和numpy。在从pythomin的输出不能更新。(我没试过)
根据@squid的答案,您可以使用一个名为^{} 的nose插件,用cProfile替换nose默认的profiler hotshot。在
要安装它:
然后这样叫鼻子:
^{pr2}$它应该生成一个cProfile输出文件,然后您可以使用
runsnakerun
等工具对其进行分析。在相关问题 更多 >
编程相关推荐