内容简介:http://stackoverflow.com/questions/13155735/how-to-prevent-pycallgraph-from-entering-standard-library-functions
来配置和绘制一个相对简单的程序的调用图.然而,即使我不使用-s命令行选项,所得到的映像也包括标准库(线程,json,套接字)的内部.使用-e选项排除这些模块没有任何效果,而使用-i会导致一个空的调用图.我也试过cProfile,但它只是图形主线程.
如何让我的代码只能显示呼叫?目前凌乱的结果是无用的.
编辑:我使用0.5.1,可通过easy_install.运行pycallgraph ./cursesclient.py输出:.你可以看到,pycallgraph展示了模块json,re,编码,套接字和线程的内部结构. Re和编码从来不是直接在我的代码中,而是分别通过json和socket来调用.
pycallgraph有一个未记录的stop_trace()方法,您可以使用它来排除代码段.就像是
import pycallgraph
import mycode
import stuff_i_dont_want_to_see
pycallgraph.start_trace()
#Initializations
pycallgraph.stop_trace()
stuff_i_dont_want_to_see()
pycallgraph.start_trace()
mycode.things()
pycallgraph.make_dot_graph('cleaner_graph.png')
这是你以后吗?
http://stackoverflow.com/questions/13155735/how-to-prevent-pycallgraph-from-entering-standard-library-functions
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Persuasive Technology
B.J. Fogg / Morgan Kaufmann / 2002-12 / USD 39.95
Can computers change what you think and do? Can they motivate you to stop smoking, persuade you to buy insurance, or convince you to join the Army? "Yes, they can," says Dr. B.J. Fogg, directo......一起来看看 《Persuasive Technology》 这本书的介绍吧!