mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
defer importing ProfileSession
This commit is contained in:
parent
bdc229dbab
commit
aa5bebac85
@ -9,7 +9,6 @@ __all__ = ['Task', 'TaskManager',
|
|||||||
from direct.directnotify.DirectNotifyGlobal import *
|
from direct.directnotify.DirectNotifyGlobal import *
|
||||||
from direct.showbase import ExceptionVarDump
|
from direct.showbase import ExceptionVarDump
|
||||||
from direct.showbase.PythonUtil import *
|
from direct.showbase.PythonUtil import *
|
||||||
from direct.showbase.ProfileSession import ProfileSession
|
|
||||||
import signal
|
import signal
|
||||||
import types
|
import types
|
||||||
import time
|
import time
|
||||||
@ -550,6 +549,10 @@ class TaskManager:
|
|||||||
# call to get a profile session that you can modify before passing to profileFrames()
|
# call to get a profile session that you can modify before passing to profileFrames()
|
||||||
if name is None:
|
if name is None:
|
||||||
name = 'taskMgrFrameProfile'
|
name = 'taskMgrFrameProfile'
|
||||||
|
|
||||||
|
# Defer this import until we need it: some Python
|
||||||
|
# distributions don't provide the profile and pstats modules.
|
||||||
|
from direct.showbase.ProfileSession import ProfileSession
|
||||||
return ProfileSession(name)
|
return ProfileSession(name)
|
||||||
|
|
||||||
def profileFrames(self, num=None, session=None, callback=None):
|
def profileFrames(self, num=None, session=None, callback=None):
|
||||||
@ -634,6 +637,9 @@ class TaskManager:
|
|||||||
task.setArgs(taskArgs, appendTask)
|
task.setArgs(taskArgs, appendTask)
|
||||||
task.setFunction(profileInfo.taskFunc)
|
task.setFunction(profileInfo.taskFunc)
|
||||||
|
|
||||||
|
# Defer this import until we need it: some Python
|
||||||
|
# distributions don't provide the profile and pstats modules.
|
||||||
|
from direct.showbase.ProfileSession import ProfileSession
|
||||||
profileSession = ProfileSession('profiled-task-%s' % task.getName(),
|
profileSession = ProfileSession('profiled-task-%s' % task.getName(),
|
||||||
Functor(profileInfo.taskFunc, *profileInfo.taskArgs))
|
Functor(profileInfo.taskFunc, *profileInfo.taskArgs))
|
||||||
ret = profileSession.run()
|
ret = profileSession.run()
|
||||||
|
@ -21,7 +21,6 @@ from direct.directnotify.DirectNotifyGlobal import *
|
|||||||
from direct.showbase.PythonUtil import *
|
from direct.showbase.PythonUtil import *
|
||||||
from direct.showbase.MessengerGlobal import *
|
from direct.showbase.MessengerGlobal import *
|
||||||
from direct.showbase import ExceptionVarDump
|
from direct.showbase import ExceptionVarDump
|
||||||
from direct.showbase.ProfileSession import ProfileSession
|
|
||||||
import time
|
import time
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import string
|
import string
|
||||||
@ -873,6 +872,10 @@ class TaskManager:
|
|||||||
# don't profile the same task twice in a row
|
# don't profile the same task twice in a row
|
||||||
doProfile = doProfile and (not profileInfo.profiled)
|
doProfile = doProfile and (not profileInfo.profiled)
|
||||||
|
|
||||||
|
# Defer this import until we need it: some Python
|
||||||
|
# distributions don't provide the profile and pstats modules.
|
||||||
|
from direct.showbase.ProfileSession import ProfileSession
|
||||||
|
|
||||||
if not self.taskTimerVerbose:
|
if not self.taskTimerVerbose:
|
||||||
startTime = self.trueClock.getShortTime()
|
startTime = self.trueClock.getShortTime()
|
||||||
|
|
||||||
@ -1034,6 +1037,10 @@ class TaskManager:
|
|||||||
# call to get a profile session that you can modify before passing to profileFrames()
|
# call to get a profile session that you can modify before passing to profileFrames()
|
||||||
if name is None:
|
if name is None:
|
||||||
name = 'taskMgrFrameProfile'
|
name = 'taskMgrFrameProfile'
|
||||||
|
|
||||||
|
# Defer this import until we need it: some Python
|
||||||
|
# distributions don't provide the profile and pstats modules.
|
||||||
|
from direct.showbase.ProfileSession import ProfileSession
|
||||||
return ProfileSession(name)
|
return ProfileSession(name)
|
||||||
|
|
||||||
def profileFrames(self, num=None, session=None, callback=None):
|
def profileFrames(self, num=None, session=None, callback=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user