-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) {
-/* VOIRD(action->src->id); */
-/* VOIRD(action->dst->id); */
-/* VOIRP(&ROUTE(action->src->id,action->dst->id)); */
-/* VOIRG(ROUTE(action->src->id,action->dst->id).impact_on_src); */
- scale -= ROUTE(action->src->id,action->dst->id).impact_on_src *
- lmm_variable_getvalue(action->variable);
- }
- 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);
- }
+ action = xbt_new0(s_surf_action_workstation_KCCFLN05_t, 1);
+
+ action->generic_action.using = 1;
+ action->generic_action.cost = size;
+ action->generic_action.remains = size;
+ action->generic_action.max_duration = NO_MAX_DURATION;
+ action->generic_action.start = surf_get_clock();
+ action->generic_action.finish = -1.0;
+ action->src = src;
+ action->dst = dst;
+ action->generic_action.resource_type =
+ (surf_resource_t) surf_workstation_resource;
+ action->suspended = 0; /* Should be useless because of the
+ calloc but it seems to help valgrind... */
+ action->generic_action.state_set =
+ surf_workstation_resource->common_public->states.running_action_set;
+
+ xbt_dynar_push(card_src->outgoing_communications, &action);
+ xbt_dynar_push(card_dst->incomming_communications, &action);