class Profile(_lsprof.Profiler): """Profile(timer=None, timeunit=None, subcalls=True, builtins=True)
Builds a profiler object using the specified timer function. The default timer is a fast built-in one based on real time. For custom timer functions returning integers, timeunit can be a float specifying a scale (i.e. how long each integer unit is, in seconds). """
# Most of the functionality is in the base class. # This subclass only adds convenient and backward-compatible methods.
# This method is more useful to profile a single function call. def runcall(self, func, *args, **kw): self.enable() try: return func(*args, **kw) finally: self.disable()