X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/18da6183cb7f52a959005356cee3e1388d533a14..67c9b35a2fab920823f98d10d33cdffe6f71eedc:/src/surf/surf_c_bindings.cpp diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 032280eb77..8f6185a516 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -51,7 +51,7 @@ void surf_presolve(void) } } } - xbt_dynar_foreach(model_list, iter, model) + xbt_dynar_foreach(all_existing_models, iter, model) model->updateActionsState(NOW, 0.0); } @@ -73,19 +73,17 @@ double surf_solve(double max_date) surf_min = max_date - NOW; } - XBT_DEBUG("Looking for next action end for all models except NS3"); - xbt_dynar_foreach(model_list_invoke, iter, model) { - double next_action_end = -1.0; - if (model->shareResourcesIsIdempotent()) { - XBT_DEBUG("Running for Resource [%s]", typeid(model).name()); - next_action_end = model->shareResources(NOW); - XBT_DEBUG("Resource [%s] : next action end = %f", - typeid(model).name(), next_action_end); - } - if ((surf_min < 0.0 || next_action_end < surf_min) - && next_action_end >= 0.0) { - surf_min = next_action_end; - } + /* Physical models MUST be resolved first */ + XBT_DEBUG("Looking for next event in physical models"); + double next_event_phy = surf_host_model->shareResources(NOW); + if ((surf_min < 0.0 || next_event_phy < surf_min) && next_event_phy >= 0.0) { + surf_min = next_event_phy; + } + if (surf_vm_model != NULL) { + XBT_DEBUG("Looking for next event in virtual models"); + double next_event_virt = surf_vm_model->shareResources(NOW); + if ((surf_min < 0.0 || next_event_virt < surf_min) && next_event_virt >= 0.0) + surf_min = next_event_virt; } XBT_DEBUG("Min for resources (remember that NS3 don't update that value) : %f", surf_min); @@ -152,7 +150,7 @@ double surf_solve(double max_date) NOW = NOW + surf_min; /* FIXME: model_list or model_list_invoke? revisit here later */ /* sequential version */ - xbt_dynar_foreach(model_list, iter, model) { + xbt_dynar_foreach(all_existing_models, iter, model) { model->updateActionsState(NOW, surf_min); } @@ -177,18 +175,6 @@ surf_model_t surf_resource_model(const void *host, int level) { return ws->getModel(); } -void *surf_as_cluster_get_backbone(AS_t as){ - return static_cast(as)->p_backbone; -} - -void surf_as_cluster_set_backbone(AS_t as, void* backbone){ - static_cast(as)->p_backbone = static_cast(backbone); -} - -const char *surf_model_name(surf_model_t model){ - return typeid(model).name(); -} - surf_action_t surf_model_extract_done_action_set(surf_model_t model){ if (model->getDoneActionSet()->empty()) return NULL; @@ -306,19 +292,19 @@ int surf_host_get_pstate(surf_resource_t host){ } double surf_host_get_wattmin_at(surf_resource_t resource, int pstate){ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu); - return cpuIt->second->getWattMinAt(pstate); + std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); + return hostIt->second->getWattMinAt(pstate); } double surf_host_get_wattmax_at(surf_resource_t resource, int pstate){ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu); - return cpuIt->second->getWattMaxAt(pstate); + std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); + return hostIt->second->getWattMaxAt(pstate); } double surf_host_get_consumed_energy(surf_resource_t resource){ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu); - return cpuIt->second->getConsumedEnergy(); + std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); + return hostIt->second->getConsumedEnergy(); } xbt_dict_t surf_host_get_mounted_storage_list(surf_resource_t host){