X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dd22867177c86db2e9d0b76852cb09e044b1c0c8..fc9ab0232ee601e492e7c2e271bff740fd5ad3b5:/src/surf/vm_workstation.c diff --git a/src/surf/vm_workstation.c b/src/surf/vm_workstation.c index 1ad14a76ec..e2aefd7fc8 100644 --- a/src/surf/vm_workstation.c +++ b/src/surf/vm_workstation.c @@ -258,37 +258,19 @@ static void vm_ws_restore(void *ind_vm_ws) vm_ws->current_state = SURF_VM_STATE_RUNNING; } - static double get_solved_value(surf_action_t cpu_action) { - int found = 0; - /* NOTE: Do not use surf_workstation_model's maxmin_system. It is not used. */ - lmm_system_t pm_system = surf_cpu_model_pm->model_private->maxmin_system; - lmm_variable_t var = NULL; - - xbt_swag_foreach(var, &pm_system->variable_set) { - XBT_DEBUG("var id %p id_int %d double %f", var->id, var->id_int, var->value); - if (var->id == cpu_action) { - found = 1; - break; - } - } - - if (found) - return var->value; + lmm_variable_t var = ((surf_action_lmm_t) cpu_action)->variable; - XBT_CRITICAL("bug: cannot found the solved variable of the action %p", cpu_action); - DIE_IMPOSSIBLE; - return -1; /* NOT REACHED */ + return var->value; } - - /* In the real world, processes on the guest operating system will be somewhat * degraded due to virtualization overhead. The total CPU share that these * processes get is smaller than that of the VM process gets on a host * operating system. */ -const double virt_overhead = 0.95; +// const double virt_overhead = 0.95; +const double virt_overhead = 1; static double vm_ws_share_resources(surf_model_t workstation_model, double now) { @@ -368,7 +350,7 @@ static double vm_ws_share_resources(surf_model_t workstation_model, double now) /* FIXME: 3. do we have to re-initialize our cpu_action object? */ -#if 1 +#if 0 /* iterate for all hosts including virtual machines */ xbt_lib_foreach(host_lib, cursor, key, ind_host) { workstation_CLM03_t ws_clm03 = ind_host[SURF_WKS_LEVEL]; @@ -447,6 +429,19 @@ static void vm_ws_action_cancel(surf_action_t action) } +/* Now we can set bound for each task by using MSG_task_set_bound. But, it does + * not work for the dummy CPU action of a VM. Here, we add the set_bound + * function for the dummy CPU action. */ +static void vm_ws_set_vm_bound(void *workstation, double bound) +{ + surf_resource_t ws = ((surf_resource_t) surf_workstation_resource_priv(workstation)); + xbt_assert(ws->model->type == SURF_MODEL_TYPE_VM_WORKSTATION); + workstation_VM2013_t vm_ws = (workstation_VM2013_t) ws; + + surf_action_set_bound(vm_ws->cpu_action, bound); +} + + static void surf_vm_workstation_model_init_internal(void) { surf_model_t model = surf_model_init(); @@ -523,6 +518,7 @@ static void surf_vm_workstation_model_init_internal(void) model->extension.vm_workstation.save = vm_ws_save; model->extension.vm_workstation.restore = vm_ws_restore; model->extension.vm_workstation.get_pm = vm_ws_get_pm; + model->extension.vm_workstation.set_vm_bound = vm_ws_set_vm_bound; model->extension.workstation.set_params = ws_set_params; model->extension.workstation.get_params = ws_get_params;