* \brief List of initialized models
*/
XBT_PUBLIC_DATA(xbt_dynar_t) all_existing_models;
-XBT_PUBLIC_DATA(xbt_dynar_t) model_list_invoke;
/** \ingroup SURF_simulation
- * \brief List of hosts that have juste restarted and whose autorestart process should be restarted.
+ * \brief List of hosts that have just restarted and whose autorestart process should be restarted.
*/
XBT_PUBLIC_DATA(xbt_dynar_t) host_that_restart;
Model *model = surf_host_model;
xbt_dynar_push(all_existing_models, &model);
- xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
}
Model *model = surf_host_model;
xbt_dynar_push(all_existing_models, &model);
- xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
}
surf_host_model = new HostL07Model();
Model *model = surf_host_model;
xbt_dynar_push(all_existing_models, &model);
- xbt_dynar_push(model_list_invoke, &model);
}
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);
Model *model = surf_vm_model;
xbt_dynar_push(all_existing_models, &model);
- xbt_dynar_push(model_list_invoke, &model);
}
}
{
/* TODO: update action's cost with the total cost of processes on the VM. */
-
- /* 0. Make sure that we already calculated the resource share at the physical
- * machine layer. */
- {
- XBT_ATTRIB_UNUSED Model *ws_model = surf_host_model;
- XBT_ATTRIB_UNUSED Model *vm_ws_model = surf_vm_model;
- XBT_ATTRIB_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
- XBT_ATTRIB_UNUSED unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &vm_ws_model);
- xbt_assert((index_of_pm_ws_model < index_of_vm_ws_model), "Cannot assume surf_host_model comes before");
-
- /* Another option is that we call sub_ws->share_resource() here. The
- * share_resource() function has no side-effect. We can call it here to
- * ensure that. */
- }
-
-
/* 1. Now we know how many resource should be assigned to each virtual
* machine. We update constraints of the virtual machine layer.
*