Commit 2fec6055 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

CoreObject updated to be able to keep wip stats

parent 96ea0d59
...@@ -52,8 +52,7 @@ class CoreObject(Process): ...@@ -52,8 +52,7 @@ class CoreObject(Process):
self.isPreemptive=False self.isPreemptive=False
self.resetOnPreemption=False self.resetOnPreemption=False
self.interruptCause=None self.interruptCause=None
self.gatherWipStat=False
def initialize(self): def initialize(self):
# XXX why call super.__init__ outside of __init__ ? # XXX why call super.__init__ outside of __init__ ?
...@@ -118,6 +117,10 @@ class CoreObject(Process): ...@@ -118,6 +117,10 @@ class CoreObject(Process):
self.shouldPreempt=False #flag that shows that the machine should preempt or not self.shouldPreempt=False #flag that shows that the machine should preempt or not
self.lastGiver=None # variable that holds the last giver of the object, used by machine in case of preemption self.lastGiver=None # variable that holds the last giver of the object, used by machine in case of preemption
# initialize the wipStatList -
# TODO, think what to do in multiple runs
# TODO, this should be also updated in Globals.setWIP (in case we have initial wip)
self.wipStatList=[[0,0]]
# ======================================================================= # =======================================================================
# the main process of the core object # the main process of the core object
...@@ -149,6 +152,9 @@ class CoreObject(Process): ...@@ -149,6 +152,9 @@ class CoreObject(Process):
self.timeLastEntityLeft=now() self.timeLastEntityLeft=now()
self.outputTrace(entity.name, "released "+self.objName) self.outputTrace(entity.name, "released "+self.objName)
# update wipStatList
if self.gatherWipStat:
self.wipStatList.append([now(), len(activeObjectQueue)])
return entity return entity
# ======================================================================= # =======================================================================
...@@ -245,6 +251,9 @@ class CoreObject(Process): ...@@ -245,6 +251,9 @@ class CoreObject(Process):
activeEntity.hot = True activeEntity.hot = True
# # TESTING # # TESTING
# print now(), activeEntity.id, "got into "+self.id # print now(), activeEntity.id, "got into "+self.id
# update wipStatList
if self.gatherWipStat:
self.wipStatList.append([now(), len(activeObjectQueue)])
return activeEntity return activeEntity
# ======================================================================= # =======================================================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment