/************************** AS router simcalls ***************************/
XBT_PUBLIC(xbt_dict_t) simcall_asr_get_properties(const char *name);
+/************************** New API simcalls **********************************/
+/* TUTORIAL: New API */
+/******************************************************************************/
+XBT_PUBLIC(int) simcall_new_api_fct(const char* param1, double param2);
+
SG_END_DECL()
#endif /* _SIMIX_SIMIX_H */
typedef struct s_routing_platf s_routing_platf_t, *routing_platf_t;
XBT_PUBLIC_DATA(routing_platf_t) routing_platf;
-/**
+/*******************************************
* TUTORIAL: New model
* New model extension public
* Public functions specific to a New model.
*/
-
typedef struct surf_new_model_extension_public {
surf_action_t(*fct) ();
void* (*create_resource) ();
} s_surf_model_extension_new_model_t;
-
+/*******************************************/
/** \ingroup SURF_models
* \brief Private data available on all models
s_surf_model_extension_network_t network;
s_surf_model_extension_storage_t storage;
s_surf_model_extension_workstation_t workstation;
+ /*******************************************/
+ /* TUTORIAL: New model */
s_surf_model_extension_new_model_t new_model;
+ /*******************************************/
} extension;
} s_surf_model_t;
XBT_PUBLIC_DATA(s_surf_model_description_t)
surf_workstation_model_description[];
+/*******************************************
+ * TUTORIAL: New model
+ */
+XBT_PUBLIC(void) surf_new_model_init_default(void);
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_new_model_description[];
+/*******************************************/
+
/** \ingroup SURF_models
* \brief List of initialized models
*/
static void new_model_finalize(void)
{
- THROW_UNIMPLEMENTED;
+ lmm_system_free(new_model_maxmin_system);
+ new_model_maxmin_system = NULL;
+
+ surf_model_exit(surf_new_model);
+ surf_new_model = NULL;
+
+ xbt_swag_free
+ (new_model_running_action_set_that_does_not_need_being_checked);
+ new_model_running_action_set_that_does_not_need_being_checked = NULL;
}
static void new_model_update_actions_state(double now, double delta)
{
- THROW_UNIMPLEMENTED;
+ return;
}
static double new_model_share_resources(double NOW)
{
- THROW_UNIMPLEMENTED;
- return 0;
+ return -1;
}
static int new_model_resource_used(void *resource_id)
{
}
-static void surf_new_model_model_init_internal(void)
+static void surf_new_model_init_internal(void)
{
s_surf_action_t action;
new_model_running_action_set_that_does_not_need_being_checked =
xbt_swag_new(xbt_swag_offset(action, state_hookup));
- surf_new_model->name = "Storage";
+ surf_new_model->name = "New Model";
surf_new_model->action_unref = new_model_action_unref;
surf_new_model->action_cancel = new_model_action_cancel;
surf_new_model->action_state_set = new_model_action_state_set;
}
-void surf_new_model_model_init_default(void)
+void surf_new_model_init_default(void)
{
- surf_new_model_model_init_internal();
+ surf_new_model_init_internal();
new_model_define_callbacks();
xbt_dynar_push(model_list, &surf_new_model);
{NULL, NULL, NULL} /* this array must be NULL terminated */
};
+/* ********************************************************************* */
+/* TUTORIAL: New model */
+s_surf_model_description_t surf_new_model_description[] = {
+ {"default",
+ "Tutorial model.",
+ surf_new_model_init_default},
+ {NULL, NULL, NULL} /* this array must be NULL terminated */
+};
+/* ********************************************************************* */
+
#ifdef CONTEXT_THREADS
static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
#endif
&default_value, 1, 1, &_surf_cfg_cb__storage_mode,
NULL);
+ /* ********************************************************************* */
+ /* TUTORIAL: New model */
+ sprintf(description,
+ "The model to use for the New model. Possible values: ");
+ p = description;
+ while (*(++p) != '\0');
+ for (i = 0; surf_new_model_description[i].name; i++)
+ p += sprintf(p, "%s%s", (i == 0 ? "" : ", "),
+ surf_new_model_description[i].name);
+ sprintf(p,
+ ".\n (use 'help' as a value to see the long description of each model)");
+ default_value = xbt_strdup("default");
+ xbt_cfg_register(&_surf_cfg_set, "new_model/model", description, xbt_cfgelm_string,
+ &default_value, 1, 1, &_surf_cfg_cb__storage_mode,
+ NULL);
+ /* ********************************************************************* */
+
sprintf(description,
"The model to use for the network. Possible values: ");
p = description;
XBT_DEBUG("Call storage_model_init");
storage_id = find_model_description(surf_storage_model_description, storage_model_name);
surf_storage_model_description[storage_id].model_init_preparse();
+
+ /* ********************************************************************* */
+ /* TUTORIAL: New model */
+ int new_model_id = -1;
+ char *new_model_name = NULL;
+ new_model_name = xbt_cfg_get_string(_surf_cfg_set, "new_model/model");
+ XBT_DEBUG("Call new model_init");
+ new_model_id = find_model_description(surf_new_model_description, new_model_name);
+ surf_new_model_description[new_model_id].model_init_preparse();
+ /* ********************************************************************* */
}