diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index d4019d890c..42ac1cbf75 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -2970,23 +2970,9 @@ if __debug__: assert obj2count[1] == 1 * 3 assert obj2count[2] == 2 * 3 assert obj2count[3] == 3 * 3 - assert obj2count[4] == 4 * 3 + assert obj2count[4] == 4 * 3 - - -bias=-1 def quickProfile(name="unnamed"): - global bias - if(base.config.GetBool("use-profiler",0)): - if bias == -1: - print "Calibrating profiler" - bias = prof.Profile().calibrate(100000) - print "Bias is: ",bias - prof.Profile.bias =bias - - def f8(x): - return ("%"+"8.%df"%base.config.GetInt("profile-decimals",3)) % x - pstats.f8=f8 def profileDecorator(f): if(not base.config.GetBool("use-profiler",0)): return f diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 7b2e3905f5..56a2467f81 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -32,6 +32,7 @@ import EventManager import math,sys,os import Loader import time +import profile, pstats from direct.fsm import ClassicFSM from direct.fsm import State import DirectObject @@ -115,6 +116,14 @@ class ShowBase(DirectObject.DirectObject): # has to run before libpanda is even loaded). taskMgr.resumeFunc = PStatClient.resumeAfterPause + + profile.Profile.bias = float(self.config.GetString("profile-bias")) + + + def f8(x): + return ("%"+"8.%df"%base.config.GetInt("profile-decimals",3)) % x + pstats.f8=f8 + # If the aspect ratio is 0 or None, it means to infer the # aspect ratio from the window size. # If you need to know the actual aspect ratio call base.getAspectRatio()