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,
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);
}
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;