X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/045febe057cdab268bf1d2aedae1f6db9333672d..a9d4a27f57895978422f9cd1f51fd39b939f44fd:/src/surf/cpu.c diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 5a5dc18ac9..8e087a9d6d 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -31,6 +31,7 @@ static cpu_t cpu_new(char *name, double power_scale, cpu->resource = (surf_resource_t) surf_cpu_resource; cpu->name = name; cpu->power_scale = power_scale; + xbt_assert0(cpu->power_scale>0,"Power has to be >0"); cpu->power_current = power_initial; if (power_trace) cpu->power_event = @@ -105,10 +106,9 @@ static int resource_used(void *resource_id) static void action_free(surf_action_t action) { - surf_action_cpu_t Action = (surf_action_cpu_t) action; - xbt_swag_remove(action, action->state_set); - lmm_variable_free(maxmin_system, Action->variable); + if(((surf_action_cpu_t)action)->variable) + lmm_variable_free(maxmin_system, ((surf_action_cpu_t)action)->variable); xbt_free(action); return; @@ -127,6 +127,12 @@ static void action_recycle(surf_action_t action) static void action_change_state(surf_action_t action, e_surf_action_state_t state) { + if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) + if(((surf_action_cpu_t)action)->variable) { + lmm_variable_disable(maxmin_system, ((surf_action_cpu_t)action)->variable); + ((surf_action_cpu_t)action)->variable = NULL; + } + surf_action_change_state(action, state); return; } @@ -179,9 +185,9 @@ static void update_actions_state(double now, double delta) } } - xbt_swag_foreach_safe(action, next_action, failed_actions) { - lmm_variable_disable(maxmin_system, action->variable); - } +/* xbt_swag_foreach_safe(action, next_action, failed_actions) { */ +/* lmm_variable_disable(maxmin_system, action->variable); */ +/* } */ return; }