From 582acfb7b9c29f132eb8a2149205fd5a226375c9 Mon Sep 17 00:00:00 2001 From: Zachary Pavlov Date: Wed, 30 May 2007 01:18:44 +0000 Subject: [PATCH] better profiling option --- direct/src/showbase/PythonUtil.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 5fdfd179b9..2b68871e8b 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -2954,13 +2954,19 @@ if __debug__: assert obj2count[4] == 4 * 3 + bias=-1 -def quickProfile(name="unnamed"): +def quickProfile(name="unnamed"): global bias if(base.config.GetBool("use-profiler",0)): print "Calibrating profiler" if bias == -1: prof.Profile.bias = prof.Profile().calibrate(10000) + import pstats + + def f8(x): + return ("%"+"8.%df"%base.config.GetBool("profile-decimals",3)) % x + pstats.f8=f8 def profileDecorator(f): if(not base.config.GetBool("use-profiler",0)): return f