added job-manager-timeslice-ms, job-use-overflow-time configs

This commit is contained in:
Darren Ranalli 2007-04-25 21:11:44 +00:00
parent 35290754c9
commit 645fd746a4

View File

@ -30,6 +30,7 @@ class JobManager:
# how much time did the job use beyond the allotted timeslice, used to balance # how much time did the job use beyond the allotted timeslice, used to balance
# out CPU usage # out CPU usage
self._jobId2overflowTime = {} self._jobId2overflowTime = {}
self._useOverflowTime = None
# this is a generator that we use to give high-priority jobs more timeslices # this is a generator that we use to give high-priority jobs more timeslices
self._jobIdGenerator = None self._jobIdGenerator = None
self._highestPriority = Job.Priorities.Normal self._highestPriority = Job.Priorities.Normal
@ -123,7 +124,7 @@ class JobManager:
@staticmethod @staticmethod
def getDefaultTimeslice(): def getDefaultTimeslice():
# run for 1/2 millisecond per frame by default # run for 1/2 millisecond per frame by default
return getBase().config.GetFloat('job-manager-timeslice', (1./1000.) * .5) return getBase().config.GetFloat('job-manager-timeslice-ms', .5) / 1000.
def getTimeslice(self): def getTimeslice(self):
if self._timeslice: if self._timeslice:
return self._timeslice return self._timeslice
@ -138,6 +139,8 @@ class JobManager:
return priorities return priorities
def _process(self, task=None): def _process(self, task=None):
if self._useOverflowTime is None:
self._useOverflowTime = config.GetBool('job-use-overflow-time', 1)
if len(self._pri2jobId2job): if len(self._pri2jobId2job):
#assert self.notify.debugCall() #assert self.notify.debugCall()
# figure out how long we can run # figure out how long we can run
@ -160,6 +163,7 @@ class JobManager:
# this job is no longer present # this job is no longer present
continue continue
# check if there's overflow time that we need to make up for # check if there's overflow time that we need to make up for
if self._useOverflowTime:
overflowTime = self._jobId2overflowTime[jobId] overflowTime = self._jobId2overflowTime[jobId]
timeLeft = endT - globalClock.getRealTime() timeLeft = endT - globalClock.getRealTime()
if overflowTime >= timeLeft: if overflowTime >= timeLeft: