+ cpu_t cpu = id;
+
+/* printf("[" "%lg" "] Asking to update CPU \"%s\" with value " */
+/* "%lg" " for event %p\n", surf_get_clock(), cpu->name, */
+/* value, event_type); */
+
+ if (event_type == cpu->power_event) {
+ cpu->power_current = value;
+ lmm_update_constraint_bound(maxmin_system, cpu->constraint,
+ cpu->power_current * cpu->power_scale);
+ } else if (event_type == cpu->state_event) {
+ if (value > 0)
+ cpu->state_current = SURF_CPU_ON;
+ else
+ cpu->state_current = SURF_CPU_OFF;
+ } else {
+ CRITICAL0("Unknown event ! \n");
+ xbt_abort();
+ }
+
+ return;
+}
+
+static surf_action_t execute(void *cpu, double size)
+{
+ surf_action_cpu_t action = NULL;
+ cpu_t CPU = cpu;
+
+ action = xbt_new0(s_surf_action_cpu_t, 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->generic_action.callback = cpu; */
+ action->generic_action.callback = NULL;
+ action->generic_action.resource_type =
+ (surf_resource_t) surf_cpu_resource;
+
+ if (CPU->state_current == SURF_CPU_ON)
+ action->generic_action.state_set =
+ surf_cpu_resource->common_public->states.running_action_set;
+ else
+ action->generic_action.state_set =
+ surf_cpu_resource->common_public->states.failed_action_set;
+ xbt_swag_insert(action, action->generic_action.state_set);
+
+ action->variable = lmm_variable_new(maxmin_system, action, 1.0, -1.0, 1);
+ lmm_expand(maxmin_system, ((cpu_t) cpu)->constraint, action->variable,
+ 1.0);
+
+ return (surf_action_t) action;
+}
+
+static surf_action_t action_sleep(void *cpu, double duration)
+{
+ surf_action_cpu_t action = NULL;
+
+ action = (surf_action_cpu_t) execute(cpu, 1.0);
+ action->generic_action.max_duration = duration;
+ lmm_update_variable_weight(maxmin_system, action->variable, 0.0);
+
+ return (surf_action_t) action;
+}
+
+static void action_suspend(surf_action_t action)
+{
+ lmm_update_variable_weight(maxmin_system,
+ ((surf_action_cpu_t) action)->variable, 0.0);
+}
+
+static void action_resume(surf_action_t action)
+{
+ lmm_update_variable_weight(maxmin_system,
+ ((surf_action_cpu_t) action)->variable, 1.0);