Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better use of inherency around Model::next_occuring_event_full()
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 2 Oct 2016 15:59:52 +0000 (17:59 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 2 Oct 2016 15:59:52 +0000 (17:59 +0200)
src/surf/network_interface.cpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp

index 506c345..b983e7c 100644 (file)
@@ -131,10 +131,9 @@ namespace simgrid {
 
     double NetworkModel::next_occuring_event_full(double now)
     {
 
     double NetworkModel::next_occuring_event_full(double now)
     {
-      ActionList *runningActions = surf_network_model->getRunningActionSet();
-      double minRes = shareResourcesMaxMin(runningActions, maxminSystem_);
+      double minRes = Model::next_occuring_event_full(now);
 
 
-      for(auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) {
+      for(auto it(getRunningActionSet()->begin()), itend(getRunningActionSet()->end()); it != itend ; it++) {
         NetworkAction *action = static_cast<NetworkAction*>(&*it);
         if (action->latency_ > 0)
           minRes = (minRes < 0) ? action->latency_ : std::min(minRes, action->latency_);
         NetworkAction *action = static_cast<NetworkAction*>(&*it);
         if (action->latency_ > 0)
           minRes = (minRes < 0) ? action->latency_ : std::min(minRes, action->latency_);
index a5116da..7a8c2b9 100644 (file)
@@ -72,12 +72,10 @@ NetworkL07Model::~NetworkL07Model()
 }
 
 
 }
 
 
-double HostL07Model::next_occuring_event(double /*now*/)
+double HostL07Model::next_occuring_event(double now)
 {
 {
-  ActionList *runningActions = getRunningActionSet();
-  double min = shareResourcesMaxMin(runningActions, maxminSystem_);
-
-  for (auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) {
+  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;
     L07Action *action = static_cast<L07Action*>(&*it);
     if (action->m_latency > 0 && (min < 0 || action->m_latency < min)) {
       min = action->m_latency;
index 5c262ba..d19d438 100644 (file)
@@ -110,16 +110,13 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id,
   return storage;
 }
 
   return storage;
 }
 
-double StorageN11Model::next_occuring_event(double /*now*/)
+double StorageN11Model::next_occuring_event(double now)
 {
 {
-  XBT_DEBUG("storage_share_resources");
+  double min_completion = StorageModel::next_occuring_event_full(now);
 
 
-  double min_completion = shareResourcesMaxMin(getRunningActionSet(), maxminSystem_);
-
-  // Foreach disk
   for(auto storage: p_storageList) {
     double rate = 0;
   for(auto storage: p_storageList) {
     double rate = 0;
-    // Foreach write action on disk
+    // Foreach write action on that disk
     for (auto write_action: storage->writeActions_) {
       rate += lmm_variable_getvalue(write_action->getVariable());
     }
     for (auto write_action: storage->writeActions_) {
       rate += lmm_variable_getvalue(write_action->getVariable());
     }
index 0edd2a6..78ee9ff 100644 (file)
@@ -472,15 +472,10 @@ double Model::next_occuring_event_lazy(double now)
 }
 
 double Model::next_occuring_event_full(double /*now*/) {
 }
 
 double Model::next_occuring_event_full(double /*now*/) {
-  return shareResourcesMaxMin(getRunningActionSet(), maxminSystem_);
-}
-
-double shareResourcesMaxMin(ActionList *runningActions, lmm_system_t sys)
-{
-  sys->solve_fun(sys);
+  maxminSystem_->solve_fun(maxminSystem_);
 
   double min = -1;
 
   double min = -1;
-  for(auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) {
+  for (auto it(getRunningActionSet()->begin()), itend(getRunningActionSet()->end()); it != itend ; ++it) {
     Action *action = &*it;
     double value = lmm_variable_getvalue(action->getVariable());
     if (value > 0) {
     Action *action = &*it;
     double value = lmm_variable_getvalue(action->getVariable());
     if (value > 0) {
index 3fda8ac..7f91d37 100644 (file)
@@ -277,13 +277,6 @@ typedef boost::intrusive::member_hook<
 typedef boost::intrusive::list<Action, ActionLmmOptions> ActionLmmList;
 typedef ActionLmmList* ActionLmmListPtr;
 
 typedef boost::intrusive::list<Action, ActionLmmOptions> ActionLmmList;
 typedef ActionLmmList* ActionLmmListPtr;
 
-/********************
- * Helper functions *
- ********************/
-
-double shareResourcesMaxMin(ActionList* runningActions, lmm_system_t sys);
-
-
 /*********
  * Model *
  *********/
 /*********
  * Model *
  *********/