Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better use of inherency around Model::next_occuring_event_full()
[simgrid.git] / src / surf / ptask_L07.cpp
index 82a7e71..7a8c2b9 100644 (file)
@@ -36,6 +36,7 @@ namespace surf {
 
 HostL07Model::HostL07Model() : HostModel() {
   maxminSystem_ = lmm_system_new(1);
+  maxminSystem_->solve_fun = &bottleneck_solve;
   surf_network_model = new NetworkL07Model(this,maxminSystem_);
   surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
 
@@ -71,27 +72,17 @@ NetworkL07Model::~NetworkL07Model()
 }
 
 
-double HostL07Model::next_occuring_event(double /*now*/)
+double HostL07Model::next_occuring_event(double now)
 {
-  L07Action *action;
-
-  ActionList *running_actions = getRunningActionSet();
-  double min = shareResourcesMaxMin(running_actions, maxminSystem_, bottleneck_solve);
-
-  for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end()); it != itend ; ++it) {
-    action = static_cast<L07Action*>(&*it);
-    if (action->m_latency > 0) {
-      if (min < 0) {
-        min = action->m_latency;
-        XBT_DEBUG("Updating min (value) with %p (start %f): %f", action, action->getStartTime(), min);
-      } else if (action->m_latency < min) {
-        min = action->m_latency;
-        XBT_DEBUG("Updating min (latency) with %p (start %f): %f", action, action->getStartTime(), min);
-      }
+  double min = HostModel::next_occuring_event_full(now);
+  for (auto it(getRunningActionSet()->begin()), itend(getRunningActionSet()->end()); it != itend ; ++it) {
+    L07Action *action = static_cast<L07Action*>(&*it);
+    if (action->m_latency > 0 && (min < 0 || action->m_latency < min)) {
+      min = action->m_latency;
+      XBT_DEBUG("Updating min with %p (start %f): %f", action, action->getStartTime(), min);
     }
   }
-
-  XBT_DEBUG("min value : %f", min);
+  XBT_DEBUG("min value: %f", min);
 
   return min;
 }