- while ((action = lmm_extract_modified_variable(cpu_im_maxmin_system))) {
- min = -1;
- value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
- if (value > 0) {
- if (GENERIC_ACTION(action).remains > 0)
- value = GENERIC_ACTION(action).remains / value;
- else
- value = 0.0;
- }
- if (value > 0)
- min = now + value;
-
- if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
- && (min == -1
- || GENERIC_ACTION(action).start +
- GENERIC_ACTION(action).max_duration < min))
- min =
- GENERIC_ACTION(action).start + GENERIC_ACTION(action).max_duration;
-
- DEBUG4("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
- GENERIC_ACTION(action).start, now + value,
- GENERIC_ACTION(action).max_duration);
-
- if (action->index_heap >= 0) {
- surf_action_cpu_Cas01_im_t heap_act =
- xbt_heap_remove(action_heap, action->index_heap);
- if (heap_act != action)
- DIE_IMPOSSIBLE;
- }
- if (min != -1) {
- xbt_heap_push(action_heap, action, min);
- DEBUG2("Insert at heap action(%p) min %lf", action, min);
+ xbt_swag_foreach_safe(cpu, cpu_next, cpu_im_modified_cpu) {
+ xbt_swag_foreach(action, cpu->action_set) {
+ if (GENERIC_ACTION(action).state_set !=
+ surf_cpu_model->states.running_action_set)
+ continue;
+
+ /* bogus priority, skip it */
+ if (GENERIC_ACTION(action).priority <= 0)
+ continue;
+
+ min = -1;
+ value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
+ if (value > 0) {
+ if (GENERIC_ACTION(action).remains > 0) {
+ value = GENERIC_ACTION(action).remains / value;
+ min = now + value;
+ } else {
+ value = 0.0;
+ min = now;
+ }
+ }
+
+ if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
+ && (min == -1
+ || GENERIC_ACTION(action).start +
+ GENERIC_ACTION(action).max_duration < min))
+ min =
+ GENERIC_ACTION(action).start +
+ GENERIC_ACTION(action).max_duration;
+
+ XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
+ GENERIC_ACTION(action).start, now + value,
+ GENERIC_ACTION(action).max_duration);
+
+ if (action->index_heap >= 0) {
+ surf_action_cpu_Cas01_im_t heap_act =
+ xbt_heap_remove(cpu_im_action_heap, action->index_heap);
+ if (heap_act != action)
+ DIE_IMPOSSIBLE;
+ }
+ if (min != -1) {
+ xbt_heap_push(cpu_im_action_heap, action, min);
+ XBT_DEBUG("Insert at heap action(%p) min %lf", action, min);
+ }