- if(scale<0.0) scale=0.0;
- xbt_assert0(scale>=0.0,"Negative interference !");
- } else if((xbt_dynar_length(workstation->incomming_communications)) &&
- (!xbt_dynar_length(workstation->outgoing_communications))) {
- scale = workstation->interference_recv;
- xbt_dynar_foreach (workstation->incomming_communications,cpt,action) {
- scale -= ROUTE(action->src->id,action->dst->id).impact_on_dst *
- lmm_variable_getvalue(action->variable);
- }
- if(scale<0.0) scale=0.0;
- xbt_assert0(scale>=0.0,"Negative interference !");
- } else {
- scale = workstation->interference_send_recv;
- xbt_dynar_foreach (workstation->outgoing_communications,cpt,action) {
- scale -= ROUTE(action->src->id,action->dst->id).impact_on_src_with_other_recv *
- lmm_variable_getvalue(action->variable);
- }
- xbt_dynar_foreach (workstation->incomming_communications,cpt,action) {
- scale -= ROUTE(action->src->id,action->dst->id).impact_on_dst_with_other_send *
- lmm_variable_getvalue(action->variable);
- }
- if(scale<0.0) scale=0.0;
- xbt_assert0(scale>=0.0,"Negative interference !");
- }
- lmm_update_constraint_bound(maxmin_system_cpu_KCCFLN05,workstation->constraint,
- W*scale);
- }
-
- return generic_maxmin_share_resources2(surf_cpu_resource->common_public->
- states.running_action_set,
- xbt_swag_offset(s_cpu_action, variable),
- maxmin_system_cpu_KCCFLN05);
-}
-
-static void update_actions_cpu_KCCFLN05_state(double now, double delta)
-{
- surf_action_cpu_KCCFLN05_t action = NULL;
- surf_action_cpu_KCCFLN05_t next_action = NULL;
- xbt_swag_t running_actions =
- surf_cpu_resource->common_public->states.running_action_set;
- xbt_swag_t failed_actions =
- surf_cpu_resource->common_public->states.failed_action_set;
-
- xbt_swag_foreach_safe(action, next_action, running_actions) {
- surf_double_update(&(action->generic_action.remains),
- lmm_variable_getvalue(action->variable) * delta);
- if (action->generic_action.max_duration != NO_MAX_DURATION)
- action->generic_action.max_duration -= delta;
- if ((action->generic_action.remains <= 0) &&
- (lmm_get_variable_weight(action->variable)>0)) {
- action->generic_action.finish = surf_get_clock();
- surf_action_change_state((surf_action_t) action, SURF_ACTION_DONE);
- } else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
- (action->generic_action.max_duration <= 0)) {
- action->generic_action.finish = surf_get_clock();
- surf_action_change_state((surf_action_t) action, SURF_ACTION_DONE);
- } else { /* Need to check that none of the resource has failed */
- lmm_constraint_t cnst = NULL;
- int i = 0;
- workstation_KCCFLN05_t cpu = NULL;
-
- while ((cnst =
- lmm_get_cnst_from_var(maxmin_system_cpu_KCCFLN05, action->variable,
- i++))) {
- cpu = lmm_constraint_id(cnst);
- if (cpu->state_current == SURF_CPU_OFF) {
- action->generic_action.finish = surf_get_clock();
- surf_action_change_state((surf_action_t) action, SURF_ACTION_FAILED);
- break;
- }
- }