X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/610eb721db6930318d297090f8b931b56a675e21..867ae3ddfab33175d0bce6d797b2f537396693aa:/src/surf/cpu_ti.c diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index f8ccc17695..b1c3d1d04e 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -313,7 +313,6 @@ static void cpu_ti_action_state_set(surf_action_t action, */ static void cpu_ti_update_remaining_amount(cpu_ti_t cpu, double now) { -#define GENERIC_ACTION(action) action->generic_action double area_total; surf_action_cpu_ti_t action; @@ -329,13 +328,14 @@ static void cpu_ti_update_remaining_amount(cpu_ti_t cpu, double now) cpu->last_update); xbt_swag_foreach(action, cpu->action_set) { + surf_action_t generic = (surf_action_t)action; /* action not running, skip it */ - if (GENERIC_ACTION(action).state_set != + if (generic->state_set != surf_cpu_model->states.running_action_set) continue; /* bogus priority, skip it */ - if (GENERIC_ACTION(action).priority <= 0) + if (generic->priority <= 0) continue; /* action suspended, skip it */ @@ -343,20 +343,20 @@ static void cpu_ti_update_remaining_amount(cpu_ti_t cpu, double now) continue; /* action don't need update */ - if (GENERIC_ACTION(action).start >= now) + if (generic->start >= now) continue; /* skip action that are finishing now */ - if (GENERIC_ACTION(action).finish >= 0 - && GENERIC_ACTION(action).finish <= now) + if (generic->finish >= 0 + && generic->finish <= now) continue; /* update remaining */ - double_update(&(GENERIC_ACTION(action).remains), + double_update(&(generic->remains), area_total / (cpu->sum_priority * - GENERIC_ACTION(action).priority)); + generic->priority)); XBT_DEBUG("Update remaining action(%p) remaining %lf", action, - GENERIC_ACTION(action).remains); + generic->remains); } cpu->last_update = now; #undef GENERIC_ACTION @@ -765,7 +765,7 @@ static void surf_cpu_ti_model_init_internal(void) cpu_ti_modified_cpu = xbt_swag_new(xbt_swag_offset(cpu, modified_cpu_hookup)); - surf_cpu_model->name = "CPU_TI"; + surf_cpu_model->name = "cpu_ti"; surf_cpu_model->action_unref = cpu_ti_action_unref; surf_cpu_model->action_cancel = cpu_ti_action_cancel; @@ -804,8 +804,7 @@ static void surf_cpu_ti_model_init_internal(void) void surf_cpu_model_init_ti() { - if (surf_cpu_model) - return; + xbt_assert(!surf_cpu_model,"CPU model already initialized. This should not happen."); surf_cpu_ti_model_init_internal(); cpu_ti_define_callbacks(); xbt_dynar_push(model_list, &surf_cpu_model);