程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

在分析Python脚本时,通过percall对cProfile输出进行排序

发布于2019-08-24 16:19     阅读(649)     评论(0)     点赞(2)     收藏(1)


我正在使用 python -m cProfile -s calls myscript.py

python -m cProfile -s percall myscript.py 不起作用。

Python文档说“在Stats文档中查找有效的排序值。”:http//docs.python.org/library/profile.html#module-cProfile,我找不到。


解决方案


-s仅使用sort_stats下的键。

calls (call count)
cumulative (cumulative time)
cumtime (cumulative time)
file (file name)
filename (file name)
module (file name)
ncalls (call count)
pcalls (primitive call count)
line (line number)
name (function name)
nfl (name/file/line)
stdname (standard name)
time (internal time)
tottime (internal time)

这是一个例子

python -m cProfile -s tottime myscript.py


所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:https://www.pythonheidong.com/blog/article/57206/dd6633712c051461be97/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

2 0
收藏该文
已收藏

评论内容:(最多支持255个字符)