• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pycallgraph.start_trace函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pycallgraph.start_trace函数的典型用法代码示例。如果您正苦于以下问题:Python start_trace函数的具体用法?Python start_trace怎么用?Python start_trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了start_trace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main():

    # Do the trace, remember the values for later
    pycallgraph.start_trace()
    import HTMLParser
    pycallgraph.stop_trace()

    # Set the edge colour to black for all examples
    pycallgraph.settings['edge_colour'] = lambda a, b: 'black'

    # Default node colouring
    pycallgraph.make_dot_graph('colours-default.png')

    # Rainbow
    pycallgraph.settings['node_colour'] = rainbow
    pycallgraph.make_dot_graph('colours-rainbow.png')

    # Greyscale
    pycallgraph.settings['node_colour'] = greyscale
    pycallgraph.make_dot_graph('colours-greyscale.png')

    # Orange/Green
    pycallgraph.settings['node_colour'] = orange_green
    pycallgraph.make_dot_graph('colours-orange-green.png')

    # Random
    pycallgraph.settings['node_colour'] = rand
    pycallgraph.make_dot_graph('colours-random.png')
开发者ID:1bitaway,项目名称:pycallgraph,代码行数:28,代码来源:colours.py


示例2: filter_exclude

def filter_exclude():
    filter_func = pycallgraph.GlobbingFilter(exclude=['pycallgraph.*', \
        '*.secret_function'])
    pycallgraph.start_trace(filter_func=filter_func)
    banana = Banana()
    banana.eat()
    pycallgraph.make_dot_graph('filter-exclude.png')
开发者ID:1bitaway,项目名称:pycallgraph,代码行数:7,代码来源:filter.py


示例3: run_profile

 def run_profile(self, app, *args, **kwargs):
     pycallgraph = self.pycallgraph
     pycallgraph.start_trace(reset=True, filter_func=self._filter)
     try:
         return app(*args, **kwargs)
     finally:
         pycallgraph.stop_trace()
开发者ID:IvanLogvinov,项目名称:soar,代码行数:7,代码来源:profile.py


示例4: filter_include

def filter_include():
    filter_func = pycallgraph.GlobbingFilter(include=['*.secret_function', \
        'Banana.__init__'])
    pycallgraph.start_trace(filter_func=filter_func)
    banana = Banana()
    banana.eat()
    pycallgraph.make_dot_graph('filter-include.png')
开发者ID:1bitaway,项目名称:pycallgraph,代码行数:7,代码来源:filter.py


示例5: render

    def render (self, include=None, exclude=None, **kwargs): # {{{
        """
            Actually returns an image (as png), and will reset the trace if the
            include or exclude parameters are different.
        """
        
        inc = self.last_include
        exc = self.last_exclude

        if include or include == "":
            inc = include.split(',')

        if exclude or exclude == "":
            exc = exclude.split(',')

        if inc != self.last_include or exc != self.last_exclude:
            # New trace, resetting the old one.

            pycallgraph.stop_trace()
            pycallgraph.start_trace(filter_func = self.filter_func(inc, exc), reset=True)

        pycallgraph.make_dot_graph("." + self.image_file, stop=False)

        cherrypy.response.headers['Content-Type'] = "image/png"
        f = open("." + self.image_file, "r+b")
        return f.read()
开发者ID:silky,项目名称:callgraphiti,代码行数:26,代码来源:callgraphiti.py


示例6: callwrapper

 def callwrapper(*args, **kwargs):
     if not outfile: # allow deactivating
         return fn(*args, **kwargs)
     pycallgraph.start_trace()
     fn_output = fn(*args, **kwargs)
     pycallgraph.stop_trace()
     pycallgraph.make_dot_graph(outfile)
     return fn_output
开发者ID:ozymandium,项目名称:py-sandbox,代码行数:8,代码来源:pycallgraph_deco.py


示例7: main

def main():
    pycallgraph.settings['dont_exclude_anything'] = True
    import_list = ['pickle', 'htmllib']

    for imp in import_list:
        pycallgraph.start_trace()
        __import__(imp)
        pycallgraph.make_dot_graph('import-%s.png' % imp)
开发者ID:1bitaway,项目名称:pycallgraph,代码行数:8,代码来源:import.py


示例8: call_graph

 def call_graph(fac, cmd='fac.query(1)'):
     import pycallgraph
     import Image
     iom = fac.hs.iom
     logmsg('Call Graph Command: '+cmd)
     callgraph_fpath = iom.get_temp_fpath('callgraph'+cmd+'.png')
     pycallgraph.start_trace()
     eval(cmd)
     pycallgraph.stop_trace()
     pycallgraph.make_dot_graph(callgraph_fpath)
     Image.open(callgraph_fpath).show()
开发者ID:Erotemic,项目名称:hotspotter,代码行数:11,代码来源:Facade.py


示例9: cuba

def cuba():
    eqs = '''
    dv/dt = (ge+gi-(v+49*mV))/(20*ms) : volt
    dge/dt = -ge/(5*ms) : volt
    dgi/dt = -gi/(10*ms) : volt
    '''
    eqs = Equations(eqs)
    pycallgraph.start_trace(filter_func=ff)
    eqs.prepare()
    pycallgraph.stop_trace()
    pycallgraph.make_dot_graph('callgraphs/cuba-bigcallgraph-Equations.prepare.png')
开发者ID:JoErNanO,项目名称:brian,代码行数:11,代码来源:cuba_big_callgraph.py


示例10: main

def main():
    if PYCALLGRAPH:
        pycallgraph.start_trace()
        test_cetco()
        pycallgaph.make_dot_graph(os.path.join(os.path.dirname(__file__), 
            "..", "doc", "calcular_credito_disponible.png"))
    else:
        fechahora = time.localtime()
        fechahora = "%d%02d%02d%02d%02d%02d" % (fechahora.tm_year, 
                                                fechahora.tm_mon, 
                                                fechahora.tm_mday, 
                                                fechahora.tm_hour, 
                                                fechahora.tm_min, 
                                                fechahora.tm_sec)
        filestats = os.path.abspath(os.path.join(os.path.dirname(__file__), 
            "..", "doc", "credito_perf_%s.stats" % fechahora))
        #cProfile.run("test_cetco()", sort = 'cumulative')
        cProfile.run("test_cetco()", filestats, sort = 'cumulative')
        p = pstats.Stats(filestats)
        p.strip_dirs().sort_stats("time").print_stats("pclases", 10)
        p.strip_dirs().sort_stats("cumulative").print_stats("pclases", 10)
开发者ID:pacoqueen,项目名称:ginn,代码行数:21,代码来源:credito_performance.py


示例11: run

    def run(self):
        '''Main code runner for testing. To set a new test, update the self.callTest attribute in __init__(). 
        '''
        fp = environLocal.getTempFile('.png')
        gf = pycallgraph.GlobbingFilter(exclude=self.excludeList)
        # create instnace; will call setup routines
        ct = self.callTest()

        # start timer
        print('starting test')
        t = common.Timer()
        t.start()

        pycallgraph.start_trace(filter_func = gf)
        ct.testFocus() # run routine

        pycallgraph.stop_trace()
        pycallgraph.make_dot_graph(fp)

        print('elpased time: %s' % t)
        # open the completed file
        environLocal.launch('png', fp)
开发者ID:bewest,项目名称:music21-bewest.clone,代码行数:22,代码来源:timeGraphs.py


示例12: callgraph

def callgraph():
	import pycallgraph
	l = prepare()
	l.reset()
	lx = l.lexicon
	gr = l.grammar
	prp = l.properties
	#Lexicon Compile
	pycallgraph.start_trace()
	lx.compile(prp, True)
	pycallgraph.make_dot_graph('lexicon_compile.png')
	#Grammar Compile
	pycallgraph.start_trace()
	gr.compile(True)
	pycallgraph.make_dot_graph('grammar_compile.png')
	#Read
	pycallgraph.start_trace()
	l.read(u"mi pona e ilo")
	pycallgraph.make_dot_graph('read.png')
开发者ID:BackupTheBerlios,项目名称:pylilac-svn,代码行数:19,代码来源:tokipona.py


示例13: run

    def run(self, runWithEnviron=False):
        '''Main code runner for testing. To set a new test, update the self.callTest attribute in __init__(). 
        '''
        suffix = '.svg'
        fmt = suffix[1:]
        _MOD = "test.timeGraphs.py"

        if runWithEnviron:
            from music21 import environment
            environLocal = environment.Environment(_MOD)
            fp = environLocal.getTempFile(suffix)
        # manually get a temporary file
        else:
            import tempfile
            import os
            import sys
            if os.name in ['nt'] or sys.platform.startswith('win'):
                platform = 'win'
            else:
                platform = 'other'
            
            tempdir = os.path.join(tempfile.gettempdir(), 'music21')
            if platform != 'win':
                fd, fp = tempfile.mkstemp(dir=tempdir, suffix=suffix)
                if isinstance(fd, int):
                # on MacOS, fd returns an int, like 3, when this is called
                # in some context (specifically, programmatically in a 
                # TestExternal class. the fp is still valid and works
                # TODO: this did not work on MacOS 10.6.8 w/ py 2.7
                    pass
                else:
                    fd.close() 
            else:
                tf = tempfile.NamedTemporaryFile(dir=tempdir, suffix=suffix)
                fp = tf.name
                tf.close()

 
        if self.includeList is not None:
            gf = pycallgraph.GlobbingFilter(include=self.includeList, exclude=self.excludeList)
        else:
            gf = pycallgraph.GlobbingFilter(exclude=self.excludeList)
        # create instance; will call setup routines
        ct = self.callTest()

        # start timer
        print('%s starting test' % _MOD)
        t = Timer()
        t.start()

        pycallgraph.start_trace(filter_func = gf)
        ct.testFocus() # run routine

        pycallgraph.stop_trace()
        pycallgraph.make_dot_graph(fp, format=fmt, tool='/usr/local/bin/dot')
        print('elapsed time: %s' % t)
        # open the completed file
        print('file path: ' + fp)
        try:
            environLocal = environment.Environment(_MOD)
            environLocal.launch(format, fp)
        except NameError:
            pass
开发者ID:keszybz,项目名称:music21,代码行数:63,代码来源:timeGraphImportStar.py


示例14: wrapper

 def wrapper(*args, **kwargs):
     pycallgraph.start_trace()
     func(*args, **kwargs)
     pycallgraph.save_dot('callgraph.log')
     pycallgraph.make_dot_graph('callgraph.png')
开发者ID:gcmcom,项目名称:pyFileFixity,代码行数:5,代码来源:debug.py


示例15: main

def main():
    pycallgraph.start_trace()
    banana = Banana()
    banana.eat()
    pycallgraph.make_dot_graph('basic.png')
开发者ID:1bitaway,项目名称:pycallgraph,代码行数:5,代码来源:basic.py


示例16: __call__

 def __call__(self, *args, **kwargs):
     pycallgraph.start_trace(reset=False)
     return_value = self.func(*args, **kwargs)
     pycallgraph.stop_trace()
     return return_value
开发者ID:andrea-manzi,项目名称:fts3-rest,代码行数:5,代码来源:util.py


示例17: filter_max_depth

def filter_max_depth():
    filter_func = pycallgraph.GlobbingFilter(max_depth=1)
    pycallgraph.start_trace(filter_func=filter_func)
    banana = Banana()
    banana.eat()
    pycallgraph.make_dot_graph('filter-max-depth.png')
开发者ID:1bitaway,项目名称:pycallgraph,代码行数:6,代码来源:filter.py


示例18: process_view

 def process_view(self, request, callback, callback_args, callback_kwargs):
     if settings.DEBUG and 'graph' in request.GET:
         filter_func = pycallgraph.GlobbingFilter(include=['*'],
                 exclude=['debug_toolbar.*', '*.debug.*'])
         pycallgraph.start_trace(filter_func=filter_func)
开发者ID:itavor,项目名称:itavor_lib,代码行数:5,代码来源:callgraph.py


示例19: set_global_preferences

from brian import *
set_global_preferences(useweave=True)
import cuba_runopts
cuba_runopts.duration = 100 * ms
import pycallgraph
from cuba import *

cg_func = 'Connection.do_propagate'

def ff(pat):
    def f(call_stack, module_name, class_name, func_name, full_name):
        if not 'brian' in module_name: return False
        for n in call_stack + [full_name]:
            if pat in n:
                return True
        return False
    return f

def cuba(P, Pe, Pi, Ce, Ci, M, net):
    net.run(duration)

c = cubanetwork(4000)
pycallgraph.start_trace(filter_func=ff(cg_func))
cuba(*c)
pycallgraph.stop_trace()
pycallgraph.make_dot_graph('callgraphs/cuba-callgraph-' + cg_func + '.png')
开发者ID:JoErNanO,项目名称:brian,代码行数:26,代码来源:cuba_callgraph.py


示例20: start

 def start (self): # {{{
     self.started = True
     pycallgraph.start_trace(filter_func = self.filter_func())
开发者ID:silky,项目名称:callgraphiti,代码行数:3,代码来源:callgraphiti.py



注:本文中的pycallgraph.start_trace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pycalphad.equilibrium函数代码示例发布时间:2022-05-25
下一篇:
Python pycall.CallFile类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap