From: Martin Quinson Date: Sun, 2 Oct 2016 15:59:52 +0000 (+0200) Subject: better use of inherency around Model::next_occuring_event_full() X-Git-Tag: v3_14~374 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b6fc7c2d23e70b645eef83f2b138cc00dcd892d0 better use of inherency around Model::next_occuring_event_full() --- diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index 506c34578d..b983e7c3bb 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -131,10 +131,9 @@ namespace simgrid { 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(&*it); if (action->latency_ > 0) minRes = (minRes < 0) ? action->latency_ : std::min(minRes, action->latency_); diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index a5116daf0a..7a8c2b9a3a 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -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(&*it); if (action->m_latency > 0 && (min < 0 || action->m_latency < min)) { min = action->m_latency; diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 5c262baa5b..d19d438645 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -110,16 +110,13 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id, 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; - // Foreach write action on disk + // Foreach write action on that disk for (auto write_action: storage->writeActions_) { rate += lmm_variable_getvalue(write_action->getVariable()); } diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 0edd2a6a94..78ee9ffb69 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -472,15 +472,10 @@ double Model::next_occuring_event_lazy(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; - 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) { diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 3fda8ace0c..7f91d37cba 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -277,13 +277,6 @@ typedef boost::intrusive::member_hook< typedef boost::intrusive::list ActionLmmList; typedef ActionLmmList* ActionLmmListPtr; -/******************** - * Helper functions * - ********************/ - -double shareResourcesMaxMin(ActionList* runningActions, lmm_system_t sys); - - /********* * Model * *********/