- xbt_swag_remove(action, action->state_set);
- lmm_variable_free(maxmin_system_cpu_KCCFLN05, ((surf_action_cpu_KCCFLN05_t)action)->variable);
- xbt_free(action);
-}
-
-static double share_cpu_KCCFLN05_resources(double now)
-{
- s_surf_action_cpu_KCCFLN05_t s_cpu_action;
- lmm_constraint_t cnst = NULL;
- workstation_KCCFLN05_t workstation = NULL;
- double W=0.0;
- double scale=0.0;
- int cpt;
- surf_action_network_KCCFLN05_t action;
-
- for(cnst = lmm_get_first_active_constraint(maxmin_system_cpu_KCCFLN05);
- cnst;
- cnst= lmm_get_next_active_constraint(maxmin_system_cpu_KCCFLN05, cnst))
- {
- workstation = lmm_constraint_id(cnst);
- W=workstation->power_current * workstation->power_scale;
-
- if((!xbt_dynar_length(workstation->incomming_communications)) &&
- (!xbt_dynar_length(workstation->outgoing_communications))) {
- scale = 1.0;
- } else if((!xbt_dynar_length(workstation->incomming_communications)) &&
- (xbt_dynar_length(workstation->outgoing_communications))) {
- scale = workstation->interference_send;
- xbt_dynar_foreach (workstation->outgoing_communications,cpt,action) {
- scale -= ROUTE(action->src->id,action->dst->id).impact_on_src *
- lmm_variable_getvalue(action->variable);
- }
- 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);
- }
- 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);
- }
- 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) {
- 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;