+#include "cpu_private.h"
+#include "xbt/dict.h"
+
+surf_cpu_resource_t surf_cpu_resource = NULL;
+static xbt_dict_t cpu_set = NULL;
+static lmm_system_t sys = NULL;
+
+typedef struct cpu {
+ const char *name;
+ xbt_maxmin_float_t power_scale;
+ xbt_maxmin_float_t current_power;
+ tmgr_trace_t power_trace;
+ e_surf_action_state_t current_state;
+ tmgr_trace_t state_trace;
+ lmm_constraint_t constraint;
+} s_cpu_t, *cpu_t;
+
+/* power_scale is the basic power of the cpu when the cpu is
+ completely available. initial_power is therefore expected to be
+ comprised between 0.0 and 1.0, just as the values of power_trace.
+ state_trace values mean SURF_CPU_ON if >0 and SURF_CPU_OFF
+ otherwise.
+*/
+
+static void *new_cpu(const char *name, xbt_maxmin_float_t power_scale,
+ xbt_maxmin_float_t initial_power, tmgr_trace_t power_trace,
+ e_surf_cpu_state_t initial_state, tmgr_trace_t state_trace)
+{
+ cpu_t cpu = xbt_new0(s_cpu_t,1);
+
+ cpu->name = name;
+ cpu->power_scale = power_scale;
+ cpu->current_power = initial_power;
+ cpu->power_trace = power_trace;
+ cpu->current_state = initial_state;
+ cpu->state_trace = state_trace;
+ cpu->constraint = lmm_constraint_new(sys, cpu, cpu->current_power);