typedef struct surf_model_public {
s_surf_action_state_t states; /**< Any living action on this model */
void *(*name_service) (const char *name); /**< Return a model given its name */
- const char *(*get_model_name) (void *model_id); /**< Return the name of a model */
+ const char *(*get_resource_name) (void *resource_id); /**< Return the name of a model */
e_surf_action_state_t(*action_get_state) (surf_action_t action); /**< Return the state of an action */
double (*action_get_start_time) (surf_action_t action); /**< Return the start time of an action */
const char* SD_workstation_get_name(SD_workstation_t workstation) {
SD_CHECK_INIT_DONE();
xbt_assert0(workstation != NULL, "Invalid parameter");
- return surf_workstation_model->common_public->get_model_name(workstation->surf_workstation);
+ return surf_workstation_model->common_public->get_resource_name(workstation->surf_workstation);
}
/**
return xbt_dict_get_or_null(cpu_set, name);
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
- return ((cpu_Cas01_t) model_id)->name;
+ return ((cpu_Cas01_t) resource_id)->name;
}
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
return lmm_constraint_used(cpu_maxmin_system,
- ((cpu_Cas01_t) model_id)->constraint);
+ ((cpu_Cas01_t) resource_id)->constraint);
}
static int action_free(surf_action_t action)
return;
}
-static double share_models(double now)
+static double share_resources(double now)
{
s_surf_action_cpu_Cas01_t action;
- return generic_maxmin_share_models2(surf_cpu_model->common_public->
+ return generic_maxmin_share_resources2(surf_cpu_model->common_public->
states.running_action_set,
xbt_swag_offset(action, variable),
cpu_maxmin_system, lmm_solve);
return;
}
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_cpu_model->common_public->name_service = name_service;
- surf_cpu_model->common_public->get_model_name = get_model_name;
+ surf_cpu_model->common_public->get_resource_name = get_resource_name;
surf_cpu_model->common_public->action_get_state =
surf_action_get_state;
surf_cpu_model->common_public->action_get_start_time =
surf_cpu_model->common_public->action_set_data = surf_action_set_data;
surf_cpu_model->common_public->name = "CPU";
- surf_cpu_model->common_private->model_used = model_used;
- surf_cpu_model->common_private->share_models = share_models;
+ surf_cpu_model->common_private->resource_used = resource_used;
+ surf_cpu_model->common_private->share_resources = share_resources;
surf_cpu_model->common_private->update_actions_state =
update_actions_state;
- surf_cpu_model->common_private->update_model_state =
- update_model_state;
+ surf_cpu_model->common_private->update_resource_state =
+ update_resource_state;
surf_cpu_model->common_private->finalize = finalize;
surf_cpu_model->common_public->suspend = action_suspend;
return card;
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
- return ((network_card_CM02_t) model_id)->name;
+ return ((network_card_CM02_t) resource_id)->name;
}
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
return lmm_constraint_used(network_maxmin_system,
- ((network_link_CM02_t) model_id)->
+ ((network_link_CM02_t) resource_id)->
constraint);
}
return;
}
-static double share_models(double now)
+static double share_resources(double now)
{
s_surf_action_network_CM02_t s_action;
surf_action_network_CM02_t action = NULL;
surf_network_model->common_public->states.running_action_set;
double min;
- min = generic_maxmin_share_models2(running_actions,
+ min = generic_maxmin_share_resources2(running_actions,
xbt_swag_offset(s_action,
variable),
network_maxmin_system,
return;
}
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_network_model->common_public->name_service = name_service;
- surf_network_model->common_public->get_model_name =
- get_model_name;
+ surf_network_model->common_public->get_resource_name =
+ get_resource_name;
surf_network_model->common_public->action_get_state =
surf_action_get_state;
surf_network_model->common_public->action_get_start_time =
surf_action_set_data;
surf_network_model->common_public->name = "network";
- surf_network_model->common_private->model_used = model_used;
- surf_network_model->common_private->share_models = share_models;
+ surf_network_model->common_private->resource_used = resource_used;
+ surf_network_model->common_private->share_resources = share_resources;
surf_network_model->common_private->update_actions_state =
update_actions_state;
- surf_network_model->common_private->update_model_state =
- update_model_state;
+ surf_network_model->common_private->update_resource_state =
+ update_resource_state;
surf_network_model->common_private->finalize = finalize;
surf_network_model->common_public->suspend = action_suspend;
#endif
/** QUESTIONS for GTNetS integration
- ** 1. Check that we did the right thing with name_service and get_model_name
+ ** 1. Check that we did the right thing with name_service and get_resource_name
** 2. Right now there is no "kill flow" in our GTNetS implementation. Do we
** need to do something about this?
** 3. We ignore the fact there is some max_duration on flows (see #2 above)
- ** 4. share_models() returns a duration, not a date, right?
+ ** 4. share_resources() returns a duration, not a date, right?
** 5. We don't suppoer "rates"
** 6. We don't update "remaining" for ongoing flows. Is it bad?
**/
return xbt_dict_get_or_null(network_card_set, name);
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
- return ((network_card_GTNETS_t) model_id)->name;
+ return ((network_card_GTNETS_t) resource_id)->name;
}
/* We do not care about this: only used for traces */
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
return 0; /* We don't care */
}
}
-/* share_models() */
-static double share_models(double now)
+/* share_resources() */
+static double share_resources(double now)
{
#if 0
s_surf_action_network_GTNETS_t s_action;
}
/* UNUSED HERE: no traces */
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_network_model->common_public->name_service = name_service;
- surf_network_model->common_public->get_model_name =
- get_model_name;
+ surf_network_model->common_public->get_resource_name =
+ get_resource_name;
surf_network_model->common_public->action_get_state =
surf_action_get_state;
surf_network_model->common_public->action_use = action_use;
surf_action_set_data;
surf_network_model->common_public->name = "network";
- surf_network_model->common_private->model_used = model_used;
- surf_network_model->common_private->share_models = share_models;
+ surf_network_model->common_private->resource_used = resource_used;
+ surf_network_model->common_private->share_resources = share_resources;
surf_network_model->common_private->update_actions_state =
update_actions_state;
- surf_network_model->common_private->update_model_state =
- update_model_state;
+ surf_network_model->common_private->update_resource_state =
+ update_resource_state;
surf_network_model->common_private->finalize = finalize;
surf_network_model->common_public->suspend = action_suspend;
name_list);
}
-double generic_maxmin_share_models(xbt_swag_t running_actions,
+double generic_maxmin_share_resources(xbt_swag_t running_actions,
size_t offset)
{
- return generic_maxmin_share_models2(running_actions, offset,
+ return generic_maxmin_share_resources2(running_actions, offset,
maxmin_system, lmm_solve);
}
-double generic_maxmin_share_models2(xbt_swag_t running_actions,
+double generic_maxmin_share_resources2(xbt_swag_t running_actions,
size_t offset,
lmm_system_t sys,
void (*solve) (lmm_system_t))
&value,
(void **) &model_obj))) {
model_obj->model->common_private->
- update_model_state(model_obj, event, value);
+ update_resource_state(model_obj, event, value);
}
}
xbt_dynar_foreach(model_list, i, model) {
xbt_dynar_foreach(model_list, i, model) {
DEBUG1("Running for Resource [%s]", model->common_public->name);
model_next_action_end =
- model->common_private->share_models(NOW);
+ model->common_private->share_resources(NOW);
DEBUG2("Resource [%s] : next action end = %f",
model->common_public->name, model_next_action_end);
if (((min < 0.0) || (model_next_action_end < min))
&value,
(void **) &model_obj))) {
if (model_obj->model->common_private->
- model_used(model_obj)) {
+ resource_used(model_obj)) {
min = next_event_date - NOW;
DEBUG1
("This event will modify model state. Next event set to %f",
/* update state of model_obj according to new value. Does not touch lmm.
It will be modified if needed when updating actions */
model_obj->model->common_private->
- update_model_state(model_obj, event, value);
+ update_resource_state(model_obj, event, value);
}
}
} e_surf_network_link_sharing_policy_t;
typedef struct surf_model_private {
- int (*model_used) (void *model_id);
+ int (*resource_used) (void *resource_id);
/* Share the models to the actions and return in hom much time
the next action may terminate */
- double (*share_models) (double now);
+ double (*share_resources) (double now);
/* Update the actions' state */
void (*update_actions_state) (double now, double delta);
- void (*update_model_state) (void *id, tmgr_trace_event_t event_type,
+ void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
double value);
void (*finalize) (void);
} s_surf_model_private_t;
extern int use_sdp_solver;
extern int use_lagrange_solver;
-double generic_maxmin_share_models(xbt_swag_t running_actions,
+double generic_maxmin_share_resources(xbt_swag_t running_actions,
size_t offset);
-double generic_maxmin_share_models2(xbt_swag_t running_actions,
+double generic_maxmin_share_resources2(xbt_swag_t running_actions,
size_t offset,
lmm_system_t sys,
void (*solve)(lmm_system_t));
return NULL;
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
DIE_IMPOSSIBLE;
return "";
}
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
return 1;
}
return;
}
-static double share_models(double now)
+static double share_resources(double now)
{
if (xbt_heap_size(timer_heap))
return (xbt_heap_maxkey(timer_heap));
return;
}
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_timer_model->common_public->name_service = name_service;
- surf_timer_model->common_public->get_model_name =
- get_model_name;
+ surf_timer_model->common_public->get_resource_name =
+ get_resource_name;
surf_timer_model->common_public->action_get_state =
surf_action_get_state;
surf_timer_model->common_public->action_free = action_free;
surf_action_set_data;
surf_timer_model->common_public->name = "TIMER";
- surf_timer_model->common_private->model_used = model_used;
- surf_timer_model->common_private->share_models = share_models;
+ surf_timer_model->common_private->resource_used = resource_used;
+ surf_timer_model->common_private->share_resources = share_resources;
surf_timer_model->common_private->update_actions_state =
update_actions_state;
- surf_timer_model->common_private->update_model_state =
- update_model_state;
+ surf_timer_model->common_private->update_resource_state =
+ update_resource_state;
surf_timer_model->common_private->finalize = finalize;
surf_timer_model->common_public->suspend = action_suspend;
return xbt_dict_get_or_null(workstation_set, name);
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
- return ((workstation_CLM03_t) model_id)->name;
+ return ((workstation_CLM03_t) resource_id)->name;
}
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
xbt_assert0(0,
"Workstation is a virtual model. I should not be there!");
return;
}
-static double share_models(double now)
+static double share_resources(double now)
{
s_surf_action_parallel_task_CSL05_t action;
- return generic_maxmin_share_models(surf_workstation_model->
+ return generic_maxmin_share_resources(surf_workstation_model->
common_public->states.
running_action_set,
xbt_swag_offset(action, variable));
return;
}
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_workstation_model->common_public->name_service = name_service;
- surf_workstation_model->common_public->get_model_name =
- get_model_name;
+ surf_workstation_model->common_public->get_resource_name =
+ get_resource_name;
surf_workstation_model->common_public->action_get_state =
surf_action_get_state;
surf_workstation_model->common_public->action_get_start_time =
surf_action_set_data;
surf_workstation_model->common_public->name = "Workstation";
- surf_workstation_model->common_private->model_used = model_used;
- surf_workstation_model->common_private->share_models =
- share_models;
+ surf_workstation_model->common_private->resource_used = resource_used;
+ surf_workstation_model->common_private->share_resources =
+ share_resources;
surf_workstation_model->common_private->update_actions_state =
update_actions_state;
- surf_workstation_model->common_private->update_model_state =
- update_model_state;
+ surf_workstation_model->common_private->update_resource_state =
+ update_resource_state;
surf_workstation_model->common_private->finalize = finalize;
surf_workstation_model->common_public->suspend = action_suspend;
return res;
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
/* We can freely cast as a cpu_KCCFLN05_t because it has the same
prefix as network_link_KCCFLN05_t. However, only cpu_KCCFLN05_t
will theoretically be given as an argument here. */
- return ((cpu_KCCFLN05_t) model_id)->name;
+ return ((cpu_KCCFLN05_t) resource_id)->name;
}
/* action_get_state is inherited from the surf module */
/******* Resource Private **********/
/**************************************/
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
/* We can freely cast as a network_link_KCCFLN05_t because it has
the same prefix as cpu_KCCFLN05_t */
- if (((cpu_KCCFLN05_t) model_id)->type ==
+ if (((cpu_KCCFLN05_t) resource_id)->type ==
SURF_WORKSTATION_RESOURCE_CPU)
return (lmm_constraint_used
- (maxmin_system, ((cpu_KCCFLN05_t) model_id)->constraint)
- || ((((cpu_KCCFLN05_t) model_id)->bus) ?
+ (maxmin_system, ((cpu_KCCFLN05_t) resource_id)->constraint)
+ || ((((cpu_KCCFLN05_t) resource_id)->bus) ?
lmm_constraint_used(maxmin_system,
- ((cpu_KCCFLN05_t) model_id)->
+ ((cpu_KCCFLN05_t) resource_id)->
bus) : 0));
else
return lmm_constraint_used(maxmin_system,
- ((network_link_KCCFLN05_t) model_id)->
+ ((network_link_KCCFLN05_t) resource_id)->
constraint);
}
-static double share_models(double now)
+static double share_resources(double now)
{
s_surf_action_workstation_KCCFLN05_t s_action;
surf_action_workstation_KCCFLN05_t action = NULL;
xbt_swag_t running_actions =
surf_workstation_model->common_public->states.running_action_set;
- double min = generic_maxmin_share_models(running_actions,
+ double min = generic_maxmin_share_resources(running_actions,
xbt_swag_offset(s_action,
variable));
action->generic_action.finish = surf_get_clock();
surf_action_change_state((surf_action_t) action, SURF_ACTION_DONE);
} else {
- /* Need to check that none of the model has failed */
+ /* Need to check that none of the resource has failed */
lmm_constraint_t cnst = NULL;
int i = 0;
void *constraint_id = NULL;
return;
}
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
return (surf_action_t) action;
}
-static e_surf_cpu_state_t model_get_state(void *cpu)
+static e_surf_cpu_state_t resource_get_state(void *cpu)
{
return ((cpu_KCCFLN05_t) cpu)->state_current;
}
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_workstation_model->common_public->name_service = name_service;
- surf_workstation_model->common_public->get_model_name =
- get_model_name;
+ surf_workstation_model->common_public->get_resource_name =
+ get_resource_name;
surf_workstation_model->common_public->action_get_state =
surf_action_get_state;
surf_workstation_model->common_public->action_get_start_time =
action_set_priority;
surf_workstation_model->common_public->name = "Workstation KCCFLN05";
- surf_workstation_model->common_private->model_used = model_used;
- surf_workstation_model->common_private->share_models =
- share_models;
+ surf_workstation_model->common_private->resource_used = resource_used;
+ surf_workstation_model->common_private->share_resources =
+ share_resources;
surf_workstation_model->common_private->update_actions_state =
update_actions_state;
- surf_workstation_model->common_private->update_model_state =
- update_model_state;
+ surf_workstation_model->common_private->update_resource_state =
+ update_resource_state;
surf_workstation_model->common_private->finalize = finalize;
surf_workstation_model->extension_public->execute = execute;
surf_workstation_model->extension_public->sleep = action_sleep;
surf_workstation_model->extension_public->get_state =
- model_get_state;
+ resource_get_state;
surf_workstation_model->extension_public->get_speed = get_speed;
surf_workstation_model->extension_public->get_available_speed =
get_available_speed;
return xbt_dict_get_or_null(workstation_set, name);
}
-static const char *get_model_name(void *model_id)
+static const char *get_resource_name(void *resource_id)
{
/* We can freely cast as a cpu_L07_t because it has the same
prefix as network_link_L07_t. However, only cpu_L07_t
will theoretically be given as an argument here. */
- return ((cpu_L07_t) model_id)->name;
+ return ((cpu_L07_t) resource_id)->name;
}
/* action_get_state is inherited from the surf module */
/******* Resource Private **********/
/**************************************/
-static int model_used(void *model_id)
+static int resource_used(void *resource_id)
{
/* We can freely cast as a network_link_L07_t because it has
the same prefix as cpu_L07_t */
return lmm_constraint_used(ptask_maxmin_system,
- ((network_link_L07_t) model_id)->
+ ((network_link_L07_t) resource_id)->
constraint);
}
-static double share_models(double now)
+static double share_resources(double now)
{
s_surf_action_workstation_L07_t s_action;
xbt_swag_t running_actions =
surf_workstation_model->common_public->states.running_action_set;
- double min = generic_maxmin_share_models2(running_actions,
+ double min = generic_maxmin_share_resources2(running_actions,
xbt_swag_offset(s_action,
variable),
ptask_maxmin_system,
return;
}
-static void update_model_state(void *id,
+static void update_resource_state(void *id,
tmgr_trace_event_t event_type,
double value)
{
/******* Resource Private **********/
/**************************************/
-static e_surf_cpu_state_t model_get_state(void *cpu)
+static e_surf_cpu_state_t resource_get_state(void *cpu)
{
return ((cpu_L07_t) cpu)->state_current;
}
xbt_swag_new(xbt_swag_offset(action, state_hookup));
surf_workstation_model->common_public->name_service = name_service;
- surf_workstation_model->common_public->get_model_name =
- get_model_name;
+ surf_workstation_model->common_public->get_resource_name =
+ get_resource_name;
surf_workstation_model->common_public->action_get_state =
surf_action_get_state;
surf_workstation_model->common_public->action_get_start_time =
action_set_priority;
surf_workstation_model->common_public->name = "Workstation ptask_L07";
- surf_workstation_model->common_private->model_used = model_used;
- surf_workstation_model->common_private->share_models =
- share_models;
+ surf_workstation_model->common_private->resource_used = resource_used;
+ surf_workstation_model->common_private->share_resources =
+ share_resources;
surf_workstation_model->common_private->update_actions_state =
update_actions_state;
- surf_workstation_model->common_private->update_model_state =
- update_model_state;
+ surf_workstation_model->common_private->update_resource_state =
+ update_resource_state;
surf_workstation_model->common_private->finalize = finalize;
surf_workstation_model->extension_public->execute = execute;
surf_workstation_model->extension_public->sleep = action_sleep;
surf_workstation_model->extension_public->get_state =
- model_get_state;
+ resource_get_state;
surf_workstation_model->extension_public->get_speed = get_speed;
surf_workstation_model->extension_public->get_available_speed =
get_available_speed;