static void action_use(surf_action_t action)
{
- action->using++;
+ action->refcount ++;
return;
}
static int action_free(surf_action_t action)
{
- action->using--;
+ action->refcount --;
- if (!action->using) {
+ if (!action->refcount ) {
xbt_swag_remove(action, action->state_set);
if (((surf_action_workstation_L07_t) action)->variable)
lmm_variable_free(ptask_maxmin_system,
static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
- double value)
+ double value, double date)
{
cpu_L07_t cpu = id;
link_L07_t nw_link = id;
} else if (event_type == nw_link->lat_event) {
lmm_variable_t var = NULL;
surf_action_workstation_L07_t action = NULL;
+ lmm_element_t elem = NULL;
nw_link->lat_current = value;
- while (lmm_get_var_from_cnst
- (ptask_maxmin_system, nw_link->constraint, &var)) {
+ while ((var = lmm_get_var_from_cnst
+ (ptask_maxmin_system, nw_link->constraint, &elem))) {
action = lmm_variable_id(var);
if (event_type == cpu->power_event) {
cpu->power_current = value;
lmm_update_constraint_bound(ptask_maxmin_system, cpu->constraint,
- cpu->power_current);
+ cpu->power_current * cpu->power_scale);
} else if (event_type == cpu->state_event) {
if (value > 0)
cpu->state_current = SURF_CPU_ON;
action = xbt_new0(s_surf_action_workstation_L07_t, 1);
DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.",
action, workstation_nb, nb_link);
- action->generic_action.using = 1;
+ action->generic_action.refcount = 1;
action->generic_action.cost = amount;
action->generic_action.remains = amount;
action->generic_action.max_duration = NO_MAX_DURATION;
xbt_swag_insert(action, action->generic_action.state_set);
action->rate = rate;
- if (action->rate > 0)
- action->variable =
- lmm_variable_new(ptask_maxmin_system, action, 1.0, -1.0,
- workstation_nb + nb_link);
- else
- action->variable =
- lmm_variable_new(ptask_maxmin_system, action, 1.0, action->rate,
- workstation_nb + nb_link);
+ action->variable =
+ lmm_variable_new(ptask_maxmin_system, action, 1.0,
+ (action->rate>0)?action->rate:-1.0,
+ workstation_nb + nb_link);
if (action->latency > 0)
lmm_update_variable_weight(ptask_maxmin_system,action->variable,0.0);
return ((link_L07_t) link)->lat_current;
}
+static int link_shared(const void *link)
+{
+ return lmm_constraint_is_shared(((link_L07_t) link)->constraint);
+}
/**************************************/
/*** Resource Creation & Destruction **/
static void cpu_free(void *cpu)
{
free(((cpu_L07_t) cpu)->name);
+ xbt_dict_free(&(((cpu_L07_t)cpu)->properties));
free(cpu);
}
static void link_free(void *nw_link)
{
free(((link_L07_t) nw_link)->name);
+ xbt_dict_free(&(((link_L07_t)nw_link)->properties));
free(nw_link);
}
dst_id = cpu_tmp->id;
route_action = A_surfxml_route_action;
-
- route_link_list = xbt_dynar_new(sizeof(char*), &free_string);
}
static void parse_route_set_route(void)
}
route_new(src_id, dst_id, link_list, nb_link);
}
-
- xbt_dict_free(&route_table);
}
static void add_traces(void) {
}
}
*/
- xbt_dict_free(&trace_connect_list_host_avail);
- xbt_dict_free(&trace_connect_list_power);
- xbt_dict_free(&trace_connect_list_link_avail);
- xbt_dict_free(&trace_connect_list_bandwidth);
- xbt_dict_free(&trace_connect_list_latency);
-
- xbt_dict_free(&traces_set_list);
}
static void define_callbacks(const char *file)
/* Adding callback functions */
surf_parse_reset_parser();
surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
- surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
- surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
- surfxml_add_callback(STag_surfxml_platform_cb_list, &init_data);
surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces);
- surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
- surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
- surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
- surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
- surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
- surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
- surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
- surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
- surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
- surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
}
get_link_bandwidth;
surf_workstation_model->extension_public->get_link_latency =
get_link_latency;
+ surf_workstation_model->extension_public->link_shared =
+ link_shared;
surf_workstation_model->common_public->get_properties = get_properties;
define_callbacks(filename);
update_model_description(surf_workstation_model_description,
- surf_workstation_model_description_size,
- "ptask_L07",
- (surf_model_t) surf_workstation_model);
+ "ptask_L07",
+ (surf_model_t) surf_workstation_model);
xbt_dynar_push(model_list, &surf_workstation_model);
}