当前位置: 首页>>代码示例>>Python>>正文


Python threading.settrace函数代码示例

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


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


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