X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/725c769707a505cb0a66620ca7bfce85fe107e8e..6e946bc777de0b8e23df72df530b2ff194261d8b:/src/surf/cpu_im.c diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 659349ff92..8088d27396 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -9,7 +9,7 @@ surf_model_t surf_cpu_model = NULL; lmm_system_t cpu_maxmin_system = NULL; -e_UM_t update_mechanism = UM_LAZY; +e_UM_t cpu_update_mechanism = UM_FULL; #undef GENERIC_LMM_ACTION #undef GENERIC_ACTION @@ -87,7 +87,7 @@ static void* cpu_im_create_resource(const char *name, double power_peak, cpu->core * cpu->power_scale * cpu->power_peak); xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu); - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) cpu->action_set = xbt_swag_new(xbt_swag_offset(action, cpu_list_hookup)); return cpu; @@ -159,7 +159,7 @@ static int cpu_im_action_unref(surf_action_t action) if (((surf_action_lmm_t) action)->variable) lmm_variable_free(cpu_im_maxmin_system, ((surf_action_lmm_t) action)->variable); - if(update_mechanism == UM_FULL){ + if(cpu_update_mechanism == UM_LAZY){ /* remove from heap */ xbt_heap_remove(cpu_im_action_heap, ((surf_action_cpu_Cas01_im_t) action)->index_heap); @@ -179,7 +179,7 @@ static int cpu_im_action_unref(surf_action_t action) static void cpu_im_action_cancel(surf_action_t action) { surf_action_state_set(action, SURF_ACTION_FAILED); - if(update_mechanism == UM_FULL){ + if(cpu_update_mechanism == UM_LAZY){ xbt_heap_remove(cpu_im_action_heap, ((surf_action_cpu_Cas01_im_t) action)->index_heap); xbt_swag_remove(action, @@ -379,7 +379,7 @@ static void cpu_im_update_resource_state(void *id, lmm_update_variable_bound(cpu_im_maxmin_system, GENERIC_LMM_ACTION(action).variable, cpu->power_scale * cpu->power_peak); } - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) xbt_swag_insert(cpu, cpu_im_modified_cpu); if (tmgr_trace_event_free(event_type)) cpu->power_event = NULL; @@ -433,7 +433,7 @@ static surf_action_t cpu_im_execute(void *cpu, double size) GENERIC_LMM_ACTION(action).variable = lmm_variable_new(cpu_im_maxmin_system, action, GENERIC_ACTION(action).priority, CPU->power_scale * CPU->power_peak, 1); - if(update_mechanism == UM_FULL){ + if(cpu_update_mechanism == UM_LAZY){ action->index_heap = -1; action->cpu = CPU; xbt_swag_insert(CPU, cpu_im_modified_cpu); @@ -467,7 +467,7 @@ static surf_action_t cpu_im_action_sleep(void *cpu, double duration) lmm_update_variable_weight(cpu_im_maxmin_system, GENERIC_LMM_ACTION(action).variable, 0.0); - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) xbt_swag_insert(cpu, cpu_im_modified_cpu); XBT_OUT(); return (surf_action_t) action; @@ -481,7 +481,7 @@ static void cpu_im_action_suspend(surf_action_t action) ((surf_action_lmm_t) action)->variable, 0.0); ((surf_action_lmm_t) action)->suspended = 1; - if(update_mechanism == UM_FULL){ + if(cpu_update_mechanism == UM_LAZY){ xbt_heap_remove(cpu_im_action_heap, ((surf_action_cpu_Cas01_im_t) action)->index_heap); xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu); @@ -499,7 +499,7 @@ static void cpu_im_action_resume(surf_action_t action) ((surf_action_lmm_t) action)->variable, action->priority); ((surf_action_lmm_t) action)->suspended = 0; - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu); } XBT_OUT(); @@ -517,7 +517,7 @@ static void cpu_im_action_set_max_duration(surf_action_t action, action->max_duration = duration; /* insert cpu in modified_cpu set to notice the max duration change */ - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu); XBT_OUT(); } @@ -531,7 +531,7 @@ static void cpu_im_action_set_priority(surf_action_t action, ((surf_action_lmm_t) action)->variable, priority); - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu); XBT_OUT(); } @@ -550,7 +550,7 @@ static double cpu_im_action_get_remains(surf_action_t action) { XBT_IN("(%p)", action); /* update remains before return it */ - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) cpu_im_update_remains(ACTION_GET_CPU(action), surf_get_clock()); return action->remains; XBT_OUT(); @@ -652,7 +652,7 @@ static void surf_cpu_im_model_init_internal(const char* name) sg_maxmin_selective_update = 1; cpu_im_maxmin_system = lmm_system_new(); } - if(update_mechanism == UM_FULL){ + if(cpu_update_mechanism == UM_LAZY){ cpu_im_action_heap = xbt_heap_new(8, NULL); xbt_heap_set_update_callback(cpu_im_action_heap, cpu_im_action_update_index_heap); @@ -681,9 +681,9 @@ void surf_cpu_model_init_Cas01_im() { char* name; if( strcmp(xbt_cfg_get_string(_surf_cfg_set, "cpu/model"),"Cas01")) - update_mechanism = UM_FULL; + cpu_update_mechanism = UM_LAZY; else - update_mechanism = UM_LAZY; + cpu_update_mechanism = UM_FULL; if (surf_cpu_model) return; @@ -695,9 +695,9 @@ void surf_cpu_model_init_Cas01_im() double generic_share_resources(double now) { surf_action_cpu_Cas01_im_t action; - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) return cpu_im_share_resources(now); - else if (update_mechanism == UM_LAZY) + else if (cpu_update_mechanism == UM_FULL) { return generic_maxmin_share_resources(surf_cpu_model->states.running_action_set, xbt_swag_offset(*action, generic_lmm_action.variable), @@ -749,9 +749,9 @@ static void cpu_update_actions_state(double now, double delta) void generic_update_actions_state(double now, double delta) { - if(update_mechanism == UM_FULL) + if(cpu_update_mechanism == UM_LAZY) cpu_im_update_actions_state(now, delta); - else if(update_mechanism == UM_LAZY) + else if(cpu_update_mechanism == UM_FULL) { cpu_update_actions_state(now, delta); }