X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7b980def32cd726e07193e679c3e97e0db47d91e..3dbeba193df2e406bd9eff5be73c8bce0db0185e:/src/surf/vm_workstation_hl13.cpp diff --git a/src/surf/vm_workstation_hl13.cpp b/src/surf/vm_workstation_hl13.cpp index 73baddfe4b..725b313a38 100644 --- a/src/surf/vm_workstation_hl13.cpp +++ b/src/surf/vm_workstation_hl13.cpp @@ -70,10 +70,10 @@ double WorkstationVMHL13Model::shareResources(double now) /* 0. Make sure that we already calculated the resource share at the physical * machine layer. */ { - ModelPtr ws_model = surf_workstation_model; - ModelPtr vm_ws_model = surf_vm_workstation_model; - unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model); - unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &vm_ws_model); + _XBT_GNUC_UNUSED ModelPtr ws_model = surf_workstation_model; + _XBT_GNUC_UNUSED ModelPtr vm_ws_model = surf_vm_workstation_model; + _XBT_GNUC_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model); + _XBT_GNUC_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_workstation_model comes before"); /* Another option is that we call sub_ws->share_resource() here. The @@ -183,26 +183,26 @@ double WorkstationVMHL13Model::shareResources(double now) ActionPtr WorkstationVMHL13Model::executeParallelTask(int workstation_nb, void **workstation_list, - double *computation_amount, - double *communication_amount, + double *flops_amount, + double *bytes_amount, double rate){ #define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0) if ((workstation_nb == 1) - && (cost_or_zero(communication_amount, 0) == 0.0)) - return ((WorkstationCLM03Ptr)workstation_list[0])->execute(computation_amount[0]); + && (cost_or_zero(bytes_amount, 0) == 0.0)) + return ((WorkstationCLM03Ptr)workstation_list[0])->execute(flops_amount[0]); else if ((workstation_nb == 1) - && (cost_or_zero(computation_amount, 0) == 0.0)) - return communicate((WorkstationCLM03Ptr)workstation_list[0], (WorkstationCLM03Ptr)workstation_list[0],communication_amount[0], rate); + && (cost_or_zero(flops_amount, 0) == 0.0)) + return communicate((WorkstationCLM03Ptr)workstation_list[0], (WorkstationCLM03Ptr)workstation_list[0],bytes_amount[0], rate); else if ((workstation_nb == 2) - && (cost_or_zero(computation_amount, 0) == 0.0) - && (cost_or_zero(computation_amount, 1) == 0.0)) { + && (cost_or_zero(flops_amount, 0) == 0.0) + && (cost_or_zero(flops_amount, 1) == 0.0)) { int i,nb = 0; double value = 0.0; for (i = 0; i < workstation_nb * workstation_nb; i++) { - if (cost_or_zero(communication_amount, i) > 0.0) { + if (cost_or_zero(bytes_amount, i) > 0.0) { nb++; - value = cost_or_zero(communication_amount, i); + value = cost_or_zero(bytes_amount, i); } } if (nb == 1) @@ -233,7 +233,7 @@ WorkstationVMHL13::WorkstationVMHL13(WorkstationVMModelPtr model, const char* na * from the VM name, we have to make sure that the system does not call the * free callback for the network resource object. The network resource object * is still used by the physical machine. */ - p_netElm = static_cast(xbt_lib_get_or_null(host_lib, sub_ws->getName(), ROUTING_HOST_LEVEL)); + p_netElm = new RoutingEdgeWrapper(static_cast(xbt_lib_get_or_null(host_lib, sub_ws->getName(), ROUTING_HOST_LEVEL))); xbt_lib_set(host_lib, name, ROUTING_HOST_LEVEL, p_netElm); p_subWs = sub_ws; @@ -277,40 +277,9 @@ WorkstationVMHL13::WorkstationVMHL13(WorkstationVMModelPtr model, const char* na */ WorkstationVMHL13::~WorkstationVMHL13() { - /* ind_phys_workstation equals to smx_host_t */ - surf_resource_t ind_vm_workstation = xbt_lib_get_elm_or_null(host_lib, getName()); - - /* Before clearing the entries in host_lib, we have to pick up resources. */ - CpuCas01Ptr cpu = static_cast(surf_cpu_resource_priv(ind_vm_workstation)); - - /* We deregister objects from host_lib, without invoking the freeing callback - * of each level. - * - * Do not call xbt_lib_remove() here. It deletes all levels of the key, - * including MSG_HOST_LEVEL and others. We should unregister only what we know. - */ - xbt_lib_unset(host_lib, getName(), SURF_CPU_LEVEL, 0); - xbt_lib_unset(host_lib, getName(), ROUTING_HOST_LEVEL, 0); - xbt_lib_unset(host_lib, getName(), SURF_WKS_LEVEL, 0); - - /* TODO: comment out when VM storage is implemented. */ - // xbt_lib_unset(host_lib, name, SURF_STORAGE_LEVEL, 0); - - /* Free the cpu_action of the VM. */ - int ret = p_action->unref(); + _XBT_GNUC_UNUSED int ret = p_action->unref(); xbt_assert(ret == 1, "Bug: some resource still remains"); - - /* Free the cpu resource of the VM. If using power_trace, we will have to */ - delete cpu; - - /* Free the network resource of the VM. */ - // Nothing has to be done, because net_elmts is just a pointer on the physical one - - /* Free the storage resource of the VM. */ - // Not relevant yet - - /* Free the workstation resource of the VM. */ } void WorkstationVMHL13::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) { @@ -379,7 +348,7 @@ void WorkstationVMHL13::migrate(surf_resource_t ind_dst_pm) /* update net_elm with that of the destination physical host */ RoutingEdgePtr old_net_elm = p_netElm; - RoutingEdgePtr new_net_elm = static_cast(xbt_lib_get_or_null(host_lib, pm_name_dst, ROUTING_HOST_LEVEL)); + RoutingEdgePtr new_net_elm = new RoutingEdgeWrapper(static_cast(xbt_lib_get_or_null(host_lib, pm_name_dst, ROUTING_HOST_LEVEL))); xbt_assert(new_net_elm); /* Unregister the current net_elm from host_lib. Do not call the free callback. */ @@ -416,11 +385,11 @@ void WorkstationVMHL13::migrate(surf_resource_t ind_dst_pm) /* keep the bound value of the cpu action of the VM. */ double old_bound = p_action->getBound(); if (old_bound != 0) { - XBT_INFO("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst); + XBT_DEBUG("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst); new_cpu_action->setBound(old_bound); } - int ret = p_action->unref(); + _XBT_GNUC_UNUSED int ret = p_action->unref(); xbt_assert(ret == 1, "Bug: some resource still remains"); p_action = new_cpu_action; @@ -428,6 +397,7 @@ void WorkstationVMHL13::migrate(surf_resource_t ind_dst_pm) XBT_DEBUG("migrate VM(%s): change net_elm (%p to %p)", vm_name, old_net_elm, new_net_elm); XBT_DEBUG("migrate VM(%s): change PM (%s to %s)", vm_name, pm_name_src, pm_name_dst); + delete old_net_elm; } void WorkstationVMHL13::setBound(double bound){