+ cpu_Cas01_t cpu = id;
+ lmm_variable_t var = NULL;
+ lmm_element_t elem = NULL;
+
+ if (event_type == cpu->power_event) {
+ cpu->power_scale = value;
+ lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
+ cpu->core * cpu->power_scale * cpu->power_peak);
+#ifdef HAVE_TRACING
+ TRACE_surf_host_set_power(date, cpu->generic_resource.name,
+ cpu->core * cpu->power_scale * cpu->power_peak);
+#endif
+ while ((var = lmm_get_var_from_cnst
+ (cpu_maxmin_system, cpu->constraint, &elem))) {
+ surf_action_cpu_Cas01_t action = lmm_variable_id(var);
+ lmm_update_variable_bound(cpu_maxmin_system, action->variable,
+ cpu->power_scale * cpu->power_peak);
+ }
+ if (tmgr_trace_event_free(event_type))
+ cpu->power_event = NULL;
+ } else if (event_type == cpu->state_event) {
+ if (value > 0)
+ cpu->state_current = SURF_RESOURCE_ON;
+ else {
+ lmm_constraint_t cnst = cpu->constraint;
+ lmm_variable_t var = NULL;
+ lmm_element_t elem = NULL;
+
+ cpu->state_current = SURF_RESOURCE_OFF;
+
+ while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
+ surf_action_t action = lmm_variable_id(var);
+
+ if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
+ surf_action_state_get(action) == SURF_ACTION_READY ||
+ surf_action_state_get(action) ==
+ SURF_ACTION_NOT_IN_THE_SYSTEM) {
+ action->finish = date;
+ cpu_action_state_set(action, SURF_ACTION_FAILED);
+ }
+ }
+ }
+ if (tmgr_trace_event_free(event_type))
+ cpu->state_event = NULL;
+ } else {
+ XBT_CRITICAL("Unknown event ! \n");
+ xbt_abort();
+ }
+