mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
moved profiling code into showbase for a more reasonable access
This commit is contained in:
parent
cab1ce3e0b
commit
f2f61a626c
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user