#include "surf_private.h"
-typedef s_surf_action_lmm_t s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
+typedef s_surf_action_lmm_t s_surf_action_cpu_Cas01_t,
+ *surf_action_cpu_Cas01_t;
typedef struct cpu_Cas01 {
s_surf_resource_t generic_resource;
lmm_constraint_new(cpu_maxmin_system, cpu,
cpu->power_scale * cpu->power_peak);
- xbt_dict_set(surf_model_resource_set(surf_cpu_model), name, cpu, surf_resource_free);
+ xbt_dict_set(surf_model_resource_set(surf_cpu_model), name, cpu,
+ surf_resource_free);
return cpu;
}
{
surf_parse_reset_parser();
surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
+ surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu);
}
static int resource_used(void *resource_id)
}
static void cpu_action_state_set(surf_action_t action,
- e_surf_action_state_t state)
+ e_surf_action_state_t state)
{
/* if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
/* if(((surf_action_cpu_Cas01_t)action)->variable) { */
static double share_resources(double now)
{
s_surf_action_cpu_Cas01_t action;
- return generic_maxmin_share_resources(surf_cpu_model->states.
- running_action_set,
+ return generic_maxmin_share_resources(surf_cpu_model->
+ states.running_action_set,
xbt_swag_offset(action, variable),
cpu_maxmin_system, lmm_solve);
}
cpu->power_scale = value;
lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
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;
}
}
}
+ if (tmgr_trace_event_free(event_type))
+ cpu->state_event = NULL;
} else {
CRITICAL0("Unknown event ! \n");
xbt_abort();
cpu_Cas01_t CPU = cpu;
XBT_IN2("(%s,%g)", surf_resource_name(CPU), size);
- action = surf_action_new(sizeof(s_surf_action_cpu_Cas01_t),size,surf_cpu_model,
- CPU->state_current != SURF_RESOURCE_ON);
+ action =
+ surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size, surf_cpu_model,
+ CPU->state_current != SURF_RESOURCE_ON);
action->suspended = 0; /* Should be useless because of the
calloc but it seems to help valgrind... */
XBT_OUT;
}
+static double action_get_remains(surf_action_t action)
+{
+ XBT_IN1("(%p)", action);
+ return action->remains;
+ XBT_OUT;
+}
+
static e_surf_resource_state_t get_state(void *cpu)
{
return ((cpu_Cas01_t) cpu)->state_current;
surf_cpu_model->is_suspended = action_is_suspended;
surf_cpu_model->set_max_duration = action_set_max_duration;
surf_cpu_model->set_priority = action_set_priority;
+ surf_cpu_model->get_remains = action_get_remains;
+
surf_cpu_model->extension.cpu.execute = execute;
surf_cpu_model->extension.cpu.sleep = action_sleep;