+ XBT_IN1("(%p)", action);
+ if (((surf_action_cpu_Cas01_t) action)->suspended != 2) {
+ lmm_update_variable_weight(cpu_maxmin_system,
+ ((surf_action_cpu_Cas01_t) action)->variable,
+ 0.0);
+ ((surf_action_cpu_Cas01_t) action)->suspended = 1;
+ }
+ XBT_OUT;
+}
+
+static void cpu_action_resume(surf_action_t action)
+{
+ XBT_IN1("(%p)", action);
+ if (((surf_action_cpu_Cas01_t) action)->suspended != 2) {
+ lmm_update_variable_weight(cpu_maxmin_system,
+ ((surf_action_cpu_Cas01_t) action)->variable,
+ action->priority);
+ ((surf_action_cpu_Cas01_t) action)->suspended = 0;
+ }
+ XBT_OUT;
+}
+
+static int cpu_action_is_suspended(surf_action_t action)
+{
+ return (((surf_action_cpu_Cas01_t) action)->suspended == 1);
+}
+
+static void cpu_action_set_max_duration(surf_action_t action, double duration)
+{
+ XBT_IN2("(%p,%g)", action, duration);
+ action->max_duration = duration;
+ XBT_OUT;
+}
+
+static void cpu_action_set_priority(surf_action_t action, double priority)
+{
+ XBT_IN2("(%p,%g)", action, priority);
+ action->priority = priority;
+ lmm_update_variable_weight(cpu_maxmin_system,
+ ((surf_action_cpu_Cas01_t) action)->variable,
+ priority);
+
+ XBT_OUT;
+}
+
+static double cpu_action_get_remains(surf_action_t action)
+{
+ XBT_IN1("(%p)", action);
+ return action->remains;
+ XBT_OUT;
+}
+
+static e_surf_resource_state_t cpu_get_state(void *cpu)
+{
+ return ((cpu_Cas01_t) cpu)->state_current;
+}
+
+static double cpu_get_speed(void *cpu, double load)
+{
+ return load * (((cpu_Cas01_t) cpu)->power_peak);
+}
+
+static double cpu_get_available_speed(void *cpu)
+{
+ /* number between 0 and 1 */
+ return ((cpu_Cas01_t) cpu)->power_scale;
+}
+
+static void cpu_create_resource(char *name, double power_peak,
+ double power_scale,
+ tmgr_trace_t power_trace,
+ e_surf_resource_state_t state_initial,
+ tmgr_trace_t state_trace,
+ xbt_dict_t cpu_properties)
+{
+ cpu_new(name,power_peak,power_scale,power_trace,
+ state_initial,state_trace,cpu_properties);