def runctx(cmd,globals=None,locals=None,nruns=200):
    """
        Runs the command @cmd with with the given @globlas and @locals
        and collects profile data. The command is run @nruns (200 by default) and
        the data is averaged over these runs. Returns
        a Stats object with the collected data.
    """
    _locals = locals or {}
    _globals = globals or {}
    _profile.start()
    _profile.run(cmd,_globals,_locals,nruns)
    _profile.stop()
    return Stats(_profile.data,nruns)
 def runctx(self,cmd,globals,locals,nruns=200):
     """
         Runs the command @cmd with the given @globlas and @locals
         and collects profile data. The command is run @ntimes (200 by default) and
         the data is averaged over these runs.
     """
     _profile.stop()
     _profile.clear()
     _profile.start()
     for i in range(nruns):
         _profile.run(cmd,globals=globals,locals=locals)
     _profile.stop()
     self._profile = Stats(_profile.data,nruns)
Example #3
0
def runctx(cmd,globals=None,locals=None,nruns=200):
    """
        Runs the command @cmd with with the given @globlas and @locals
        and collects profile data. The command is run @nruns (200 by default) and
        the data is averaged over these runs. Returns
        a Stats object with the collected data.
    """
    _locals = locals or {}
    _globals = globals or {}
    _profile.start()
    _profile.run(cmd,_globals,_locals,nruns)
    _profile.stop()
    return Stats(_profile.data,nruns)
Example #4
0
 def runctx(self,cmd,globals,locals,nruns=200):
     """
         Runs the command @cmd with the given @globlas and @locals
         and collects profile data. The command is run @ntimes (200 by default) and
         the data is averaged over these runs.
     """
     _profile.stop()
     _profile.clear()
     _profile.start()
     for i in range(nruns):
         _profile.run(cmd,globals=globals,locals=locals)
     _profile.stop()
     self._profile = Stats(_profile.data,nruns)
 def runcall(self,func,ntimes,*args,**kwargs):
     """
         Calls the function @func with arguments @args, @kwargs
         and collects profile data. The function is called @ntimes
         and the data is averaged over these runs.
     """
     _profile.stop()
     _profile.clear()
     _profile.start()
     for i in range(ntimes):
         ret=func(*args,**kwargs)
     _profile.stop()
     self._profile = Stats(_profile.data,ntimes)
     return self._profile
Example #6
0
 def runcall(self,func,ntimes,*args,**kwargs):
     """
         Calls the function @func with arguments @args, @kwargs
         and collects profile data. The function is called @ntimes
         and the data is averaged over these runs.
     """
     _profile.stop()
     _profile.clear()
     _profile.start()
     for i in range(ntimes):
         ret=func(*args,**kwargs)
     _profile.stop()
     self._profile = Stats(_profile.data,ntimes)
     return self._profile
 def enable(self):
     """
         Start collecting profile data.
     """
     _profile.start()
Example #8
0
 def enable(self):
     """
         Start collecting profile data.
     """
     _profile.start()