/********* cpu object *****************/
/**************************************/
typedef struct cpu_L07 {
- s_surf_resource_t generic_resource; /* Do not move this field: must match surf_resource_t */
+ s_surf_resource_t generic_resource; /* Do not move this field: must match surf_resource_t */
e_surf_workstation_model_type_t type; /* Do not move this field: must match link_L07_t */
lmm_constraint_t constraint; /* Do not move this field: must match link_L07_t */
double power_scale;
/**************************************/
typedef struct link_L07 {
- s_surf_resource_t generic_resource; /* Do not move this field: must match surf_resource_t */
+ s_surf_resource_t generic_resource; /* Do not move this field: must match surf_resource_t */
e_surf_workstation_model_type_t type; /* Do not move this field: must match cpu_L07_t */
lmm_constraint_t constraint; /* Do not move this field: must match cpu_L07_t */
double lat_current;
double lat = 0.0;
if (action->communication_amount[i * workstation_nb + j] > 0) {
- xbt_dynar_foreach(route,cpt,link) {
+ xbt_dynar_foreach(route, cpt, link) {
lat += link->lat_current;
}
lat_current =
XBT_OUT;
}
+static double action_get_remains(surf_action_t action)
+{
+ XBT_IN1("(%p)", action);
+ return action->remains;
+ XBT_OUT;
+}
+
/**************************************/
/******* Resource Private **********/
/**************************************/
SURF_RESOURCE_OFF)) ||
((((cpu_L07_t) constraint_id)->type ==
SURF_WORKSTATION_RESOURCE_CPU) &&
- (((cpu_L07_t) constraint_id)->state_current == SURF_RESOURCE_OFF))) {
+ (((cpu_L07_t) constraint_id)->state_current ==
+ SURF_RESOURCE_OFF))) {
DEBUG1("Action (%p) Failed!!", action);
action->generic_action.finish = surf_get_clock();
- surf_action_state_set((surf_action_t) action,
- SURF_ACTION_FAILED);
+ surf_action_state_set((surf_action_t) action, SURF_ACTION_FAILED);
break;
}
}
link_L07_t nw_link = id;
if (nw_link->type == SURF_WORKSTATION_RESOURCE_LINK) {
- DEBUG2("Updating link %s (%p)", nw_link->generic_resource.name, nw_link);
+ DEBUG2("Updating link %s (%p)", surf_resource_name(nw_link), nw_link);
if (event_type == nw_link->bw_event) {
nw_link->bw_current = value;
lmm_update_constraint_bound(ptask_maxmin_system, nw_link->constraint,
nw_link->bw_current);
+ if (tmgr_trace_event_free(event_type))
+ nw_link->bw_event = NULL;
} else if (event_type == nw_link->lat_event) {
lmm_variable_t var = NULL;
surf_action_workstation_L07_t action = NULL;
action = lmm_variable_id(var);
update_action_bound(action);
}
+ if (tmgr_trace_event_free(event_type))
+ nw_link->lat_event = NULL;
} else if (event_type == nw_link->state_event) {
if (value > 0)
nw_link->state_current = SURF_RESOURCE_ON;
else
nw_link->state_current = SURF_RESOURCE_OFF;
+ if (tmgr_trace_event_free(event_type))
+ nw_link->state_event = NULL;
} else {
CRITICAL0("Unknown event ! \n");
xbt_abort();
}
return;
} else if (cpu->type == SURF_WORKSTATION_RESOURCE_CPU) {
- DEBUG3("Updating cpu %s (%p) with value %g", cpu->generic_resource.name, cpu, value);
+ DEBUG3("Updating cpu %s (%p) with value %g", surf_resource_name(cpu), cpu,
+ value);
if (event_type == cpu->power_event) {
cpu->power_current = value;
lmm_update_constraint_bound(ptask_maxmin_system, cpu->constraint,
cpu->power_current * cpu->power_scale);
+ 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
cpu->state_current = SURF_RESOURCE_OFF;
+ if (tmgr_trace_event_free(event_type))
+ cpu->state_event = NULL;
} else {
CRITICAL0("Unknown event ! \n");
xbt_abort();
surf_network_model = NULL;
used_routing->finalize();
- host_count = 0; // FIXME: KILLME?
+ host_count = 0;
if (ptask_maxmin_system) {
lmm_system_free(ptask_maxmin_system);
double lat = 0.0;
if (communication_amount[i * workstation_nb + j] > 0)
- xbt_dynar_foreach(route,cpt,link) {
- lat += link->lat_current;
- xbt_dict_set(parallel_task_link_set, link->generic_resource.name,
- link, NULL);
+ xbt_dynar_foreach(route, cpt, link) {
+ lat += link->lat_current;
+ xbt_dict_set(parallel_task_link_set, link->generic_resource.name,
+ link, NULL);
}
latency = MAX(latency, lat);
}
if (computation_amount[i] > 0)
nb_host++;
- action=surf_action_new(sizeof(s_surf_action_workstation_L07_t),amount,surf_workstation_model,0);
- DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.",
- action, workstation_nb, nb_link);
+ action =
+ surf_action_new(sizeof(s_surf_action_workstation_L07_t), amount,
+ surf_workstation_model, 0);
+ DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.", action,
+ workstation_nb, nb_link);
action->suspended = 0; /* Should be useless because of the
calloc but it seems to help valgrind... */
action->workstation_nb = workstation_nb;
if (communication_amount[i * workstation_nb + j] == 0.0)
continue;
- xbt_dynar_foreach(route,cpt,link) {
+ xbt_dynar_foreach(route, cpt, link) {
lmm_expand_add(ptask_maxmin_system, link->constraint,
action->variable,
communication_amount[i * workstation_nb + j]);
{
surf_action_workstation_L07_t action = NULL;
- XBT_IN2("(%s,%g)", ((cpu_L07_t) cpu)->generic_resource.name, duration);
+ XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
action = (surf_action_workstation_L07_t) execute(cpu, 1.0);
action->generic_action.max_duration = duration;
power_scale = get_cpu_power(A_surfxml_host_power);
surf_parse_get_double(&power_initial, A_surfxml_host_availability);
- surf_parse_get_trace(&power_trace, A_surfxml_host_availability_file);
+ power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
(A_surfxml_host_state == A_surfxml_host_state_OFF),
state_initial = SURF_RESOURCE_ON;
if (A_surfxml_host_state == A_surfxml_host_state_OFF)
state_initial = SURF_RESOURCE_OFF;
- surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
+ state_trace = tmgr_trace_new(A_surfxml_host_state_file);
current_property_set = xbt_dict_new();
cpu_new(A_surfxml_host_id, power_scale, power_initial, power_trace,
lmm_constraint_shared(nw_link->constraint);
- xbt_dict_set(surf_network_model->resource_set, name, nw_link, surf_resource_free);
+ xbt_dict_set(surf_network_model->resource_set, name, nw_link,
+ surf_resource_free);
return nw_link;
}
name_link = xbt_strdup(A_surfxml_link_id);
surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
- surf_parse_get_trace(&bw_trace, A_surfxml_link_bandwidth_file);
+ bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
- surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
+ lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
|| (A_surfxml_link_state ==
A_surfxml_link_sharing_policy_FATPIPE)
policy_initial_link = SURF_LINK_FATPIPE;
- surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
+ state_trace = tmgr_trace_new(A_surfxml_link_state_file);
current_property_set = xbt_dict_new();
link_new(name_link, bw_initial, bw_trace, lat_initial, lat_trace,
/* Connect traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_L07_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
+ link_L07_t link =
+ xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_L07_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
+ link_L07_t link =
+ xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_L07_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
+ link_L07_t link =
+ xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
surf_workstation_model->is_suspended = action_is_suspended;
surf_workstation_model->set_max_duration = action_set_max_duration;
surf_workstation_model->set_priority = action_set_priority;
+ surf_workstation_model->get_remains = action_get_remains;
surf_workstation_model->name = "Workstation ptask_L07";
surf_workstation_model->model_private->resource_used = resource_used;
surf_workstation_model->extension.workstation.get_link_latency =
get_link_latency;
surf_workstation_model->extension.workstation.link_shared = link_shared;
- surf_workstation_model->extension.workstation.get_properties = surf_resource_properties;
+ surf_workstation_model->extension.workstation.get_properties =
+ surf_resource_properties;
if (!ptask_maxmin_system)
ptask_maxmin_system = lmm_system_new();
routing_model_create(sizeof(link_L07_t),
- link_new(xbt_strdup("__loopback__"),
- 498000000, NULL, 0.000015, NULL,
- SURF_RESOURCE_ON, NULL, SURF_LINK_FATPIPE, NULL));
+ link_new(xbt_strdup("__loopback__"),
+ 498000000, NULL, 0.000015, NULL,
+ SURF_RESOURCE_ON, NULL, SURF_LINK_FATPIPE,
+ NULL));
}