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

Python threading.settrace函数代码示例

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

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



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

示例1: pause

 def pause(self):
     """
     Pause tracing, but be prepared to resume.
     """
     for tracer in self.tracers:
         tracer.stop()
     threading.settrace(None)
开发者ID:dcramer,项目名称:peek,代码行数:7,代码来源:collector.py


示例2: start

 def start(self):
     assert not self.started, "can't start if already started"
     if not self.donothing:
         sys.settrace = settrace
         sys.settrace(self.globaltrace)
         threading.settrace(self.globaltrace)
     self.started = True
开发者ID:grodniewicz,项目名称:oship,代码行数:7,代码来源:coverage.py


示例3: start_instrumenting

def start_instrumenting(output_file, to_include=(), to_exclude=()):
  """Enable tracing of all function calls (from specified modules)."""
  trace_event.trace_enable(output_file)

  traceFunc = _generate_trace_function(to_include, to_exclude)
  sys.settrace(traceFunc)
  threading.settrace(traceFunc)
开发者ID:bashow0316,项目名称:chromium,代码行数:7,代码来源:instrumentation_tracing.py


示例4: set

    def set(self, function):
        """ Set a new function in sys.setprofile.

        """
        if has_threading:
            threading.settrace(function)
        sys.settrace(function)
开发者ID:fabianp,项目名称:pikos,代码行数:7,代码来源:trace_functions.py


示例5: stop

 def stop(self):
     assert self.started, "can't stop if not started"
     if not self.donothing:
         sys.settrace = osettrace
         sys.settrace(None)
         threading.settrace(None)
     self.started = False
开发者ID:grodniewicz,项目名称:oship,代码行数:7,代码来源:coverage.py


示例6: stop

    def stop(self):
        if self.started:
            sys.settrace(None)
            if hasattr(threading, 'settrace'):
                threading.settrace(None)

            self.started = False
开发者ID:Koblaid,项目名称:foolscap,代码行数:7,代码来源:figleaf.py


示例7: start

 def start(self):
     self.get_ready()
     if self.nesting == 0:  # pragma: no cover
         sys.settrace(self.t)
         if hasattr(threading, "settrace"):
             threading.settrace(self.t)
     self.nesting += 1
开发者ID:jmbruel,项目名称:SysMLBook,代码行数:7,代码来源:coverage.py


示例8: start

    def start(self):
        """Start collecting trace information."""
        if self._collectors:
            self._collectors[-1].pause()
        self._collectors.append(self)
        #print("Started: %r" % self._collectors, file=sys.stderr)

        # Check to see whether we had a fullcoverage tracer installed.
        traces0 = []
        if hasattr(sys, "gettrace"):
            fn0 = sys.gettrace()
            if fn0:
                tracer0 = getattr(fn0, '__self__', None)
                if tracer0:
                    traces0 = getattr(tracer0, 'traces', [])

        # Install the tracer on this thread.
        fn = self._start_tracer()

        for args in traces0:
            (frame, event, arg), lineno = args
            try:
                fn(frame, event, arg, lineno=lineno)
            except TypeError:
                raise Exception(
                    "fullcoverage must be run with the C trace function."
                )

        # Install our installation tracer in threading, to jump start other
        # threads.
        threading.settrace(self._installation_trace)
开发者ID:portante,项目名称:coverage,代码行数:31,代码来源:collector.py


示例9: start

 def start(self, parallel_mode=False):
     self.get_ready()
     if self.nesting == 0:                               #pragma: no cover
         sys.settrace(self.t)
         if hasattr(threading, 'settrace'):
             threading.settrace(self.t)
     self.nesting += 1
开发者ID:arem,项目名称:poker-network,代码行数:7,代码来源:coverage.py


示例10: run

    def run(self, file, globals=None, locals=None):

        if globals is None:
            #patch provided by: Scott Schlesier - when script is run, it does not 
            #use globals from pydevd:
            #This will prevent the pydevd script from contaminating the namespace for the script to be debugged
            
            #pretend pydevd is not the main module, and
            #convince the file to be debugged that it was loaded as main
            sys.modules['pydevd'] = sys.modules['__main__']
            sys.modules['pydevd'].__name__ = 'pydevd'            
            
            from imp import new_module
            m = new_module('__main__')
            sys.modules['__main__'] = m
            m.__file__ = file
            globals = m.__dict__

        if locals is None: 
            locals = globals        
            
        #Predefined (writable) attributes: __name__ is the module's name; 
        #__doc__ is the module's documentation string, or None if unavailable; 
        #__file__ is the pathname of the file from which the module was loaded, 
        #if it was loaded from a file. The __file__ attribute is not present for 
        #C modules that are statically linked into the interpreter; for extension modules 
        #loaded dynamically from a shared library, it is the pathname of the shared library file. 


        #I think this is an ugly hack, bug it works (seems to) for the bug that says that sys.path should be the same in
        #debug and run.
        if m.__file__.startswith(sys.path[0]):
            #print >> sys.stderr, 'Deleting: ', sys.path[0]
            del sys.path[0]
        
        #now, the local directory has to be added to the pythonpath
        #sys.path.insert(0, os.getcwd())
        #Changed: it's not the local directory, but the directory of the file launched
        #The file being run ust be in the pythonpath (even if it was not before)
        sys.path.insert(0, os.path.split(file)[0])
        
        # for completness, we'll register the pydevd.reader & pydevd.writer threads
        net = NetCommand(str(CMD_THREAD_CREATE), 0, '<xml><thread name="pydevd.reader" id="-1"/></xml>')
        self.writer.addCommand(net)
        net = NetCommand(str(CMD_THREAD_CREATE), 0, '<xml><thread name="pydevd.writer" id="-1"/></xml>')
        self.writer.addCommand(net)

        pydevd_tracing.SetTrace(self.trace_dispatch) 
        try:                   
            #not available in jython!  
            threading.settrace(self.trace_dispatch) # for all future threads           
        except:
            pass

        while not self.readyToRun: 
            time.sleep(0.1) # busy wait until we receive run command
            
        PyDBCommandThread(debugger).start()

        execfile(file, globals, locals) #execute the script
开发者ID:DexterW,项目名称:django-webservice-tools,代码行数:60,代码来源:pydevd.py


示例11: start

def start(filter_modules=DEFAULT_MODULES):
    tracer.init()
    if filter_modules is not None:
        tracer.set_filter_modules(filter_modules)
    threading.settrace(thread_trace)
    tracer.start_dumper()
    tracer.install_hook() 
开发者ID:HengWang,项目名称:pytrace,代码行数:7,代码来源:__init__.py


示例12: start

    def start(self):
        """Start collecting trace information."""
        if self._collectors:
            self._collectors[-1].pause()
        self._collectors.append(self)
        #print >>sys.stderr, "Started: %r" % self._collectors

        # Check to see whether we had a fullcoverage tracer installed.
        traces0 = None
        if hasattr(sys, "gettrace"):
            fn0 = sys.gettrace()
            if fn0:
                tracer0 = getattr(fn0, '__self__', None)
                if tracer0:
                    traces0 = getattr(tracer0, 'traces', None)

        # Install the tracer on this thread.
        fn = self._start_tracer()

        if traces0:
            for args in traces0:
                (frame, event, arg), lineno = args
                fn(frame, event, arg, lineno=lineno)

        # Install our installation tracer in threading, to jump start other
        # threads.
        threading.settrace(self._installation_trace)
开发者ID:dimatomp,项目名称:play,代码行数:27,代码来源:collector.py


示例13: stop_trace

 def stop_trace(self, threading_too=False):
     sys.settrace(None)
     frame = sys._getframe().f_back
     while frame and frame is not self.botframe:
         del frame.f_trace
         frame = frame.f_back
     if threading_too:
         threading.settrace(None)
开发者ID:seletz,项目名称:wdb,代码行数:8,代码来源:__init__.py


示例14: set_trace

def set_trace(on=True):
	if on:
		t = trace_handler()
		threading.settrace(t.event_handler)
		sys.settrace(t.event_handler)
	else:
		sys.settrace(None)
		threading.settrace(None)
开发者ID:Neuvoo,项目名称:legacy-portage,代码行数:8,代码来源:debug.py


示例15: opt_spew

 def opt_spew(self):
     """Print an insanely verbose log of everything that happens.
     Useful when debugging freezes or locks in complex code."""
     sys.settrace(util.spewer)
     try:
         import threading
     except ImportError:
         return
     threading.settrace(util.spewer)
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:9,代码来源:app.py


示例16: wrapper

 def wrapper(*args, **kwargs):
   trace_func = sys.gettrace()
   try:
     sys.settrace(None)
     threading.settrace(None)
     return f(*args, **kwargs)
   finally:
     sys.settrace(trace_func)
     threading.settrace(trace_func)
开发者ID:bashow0316,项目名称:chromium,代码行数:9,代码来源:instrumentation_tracing.py


示例17: pause

 def pause(self):
     """Pause tracing, but be prepared to `resume`."""
     for tracer in self.tracers:
         tracer.stop()
         stats = tracer.get_stats()
         if stats:
             print("\nCoverage.py tracer stats:")
             for k in sorted(stats.keys()):
                 print("%16s: %s" % (k, stats[k]))
     threading.settrace(None)
开发者ID:portante,项目名称:coverage,代码行数:10,代码来源:collector.py


示例18: start

 def start(self):
     """Start collecting trace information."""
     if self._collectors:
         self._collectors[-1].pause()
     self._collectors.append(self)
     # Install the tracer on this thread.
     self._start_tracer()
     # Install our installation tracer in threading, to jump start other
     # threads.
     threading.settrace(self._installation_trace)
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:10,代码来源:collector.py


示例19: start

    def start(self):
        """
        Start recording.
        """
        if not self.started:
            self.started = True

            sys.settrace(self.g)
            if hasattr(threading, 'settrace'):
                threading.settrace(self.g)
开发者ID:Koblaid,项目名称:foolscap,代码行数:10,代码来源:figleaf.py


示例20: pause

    def pause(self):
        for tracer in self.tracers:
            tracer.stop()
            stats = tracer.get_stats()
            if stats:
                print '\nCoverage.py tracer stats:'
                for k in sorted(stats.keys()):
                    print '%16s: %s' % (k, stats[k])

        threading.settrace(None)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:10,代码来源:collector.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python threading.stack_size函数代码示例发布时间:2022-05-27
下一篇:
Python threading.setprofile函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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