diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index d2becfa2f2..af811418b1 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -761,7 +761,7 @@ def profile(callback, name, terse): print '***** END PROFILE: %s *****' % name del __builtin__.__dict__['globalProfileFunc'] -def profiled(category, terse=False): +def profiled(category=None, terse=False): """ decorator for profiling functions turn categories on and off via "want-profile-categoryName 1" @@ -773,7 +773,7 @@ def profiled(category, terse=False): want-profile-particles 1 """ - assert type(category) is types.StringType, "must provide a category name for @profiled" + assert type(category) in (types.StringType, types.NoneType), "must provide a category name for @profiled" try: null = not __dev__ @@ -797,7 +797,7 @@ def profiled(category, terse=False): _base = base except: _base = simbase - if _base.config.GetBool('want-profile-%s' % category, 0): + if (category is None) or _base.config.GetBool('want-profile-%s' % category, 0): return profile(Functor(f, *args, **kArgs), name, terse) else: return f(*args, **kArgs) diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index b0afafc5e0..4e2ed8e1df 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -772,7 +772,7 @@ class TaskManager: def profileNextFrame(self): self._profileNextFrame = True - @profiled('frame') + @profiled() def _profiledFrame(self, *args, **kArgs): return self.step(*args, **kArgs)