Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
call updateRemaining when the action is suspended (fix #123)
authorFabien Chaix <chaix@ics.forth.gr>
Fri, 2 Dec 2016 13:30:57 +0000 (05:30 -0800)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 2 Dec 2016 22:54:26 +0000 (23:54 +0100)
if not, the LMM is giving the right results, but surf does not notice.

Thus the fix does not touch LMM, only surf_interface.cpp. Note that
suspend has the specificity that we cannot estimate when it will end.
Thus it does not seem appropriate to use the nextOccuringEventLazy
method which is essentially trying to find when will be the next step.
Instead I propose to call updateReaminingLazy from the suspend
function.

src/surf/surf_interface.cpp

index 01bc6f0..3f6b63d 100644 (file)
@@ -744,9 +744,14 @@ void Action::suspend()
   XBT_IN("(%p)", this);
   if (suspended_ != 2) {
     lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), 0.0);
   XBT_IN("(%p)", this);
   if (suspended_ != 2) {
     lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), 0.0);
-    suspended_ = 1;
-    if (getModel()->getUpdateMechanism() == UM_LAZY)
+    if (getModel()->getUpdateMechanism() == UM_LAZY){
       heapRemove(getModel()->getActionHeap());
       heapRemove(getModel()->getActionHeap());
+      if (getModel()->getUpdateMechanism() == UM_LAZY  && stateSet_ == getModel()->getRunningActionSet() && priority_ > 0){
+        //If we have a lazy model, we need to update the remaining value accordingly
+        updateRemainingLazy(surf_get_clock());
+      }
+    }
+    suspended_ = 1;
   }
   XBT_OUT();
 }
   }
   XBT_OUT();
 }