1 #include "simdag/simdag.h"
3 #include "xbt/asserts.h"
4 #include "xbt/sysdep.h"
7 #define CHECK_INIT_DONE() xbt_assert0(init_done, "SG_init not called yet")
9 SG_global_t sg_global = NULL;
11 static int init_done = 0;
13 /* Initialises SG internal data. This function should be called before any other SG function.
15 void SG_init(int *argc, char **argv) {
16 xbt_assert0(!init_done, "SG_init already called");
18 sg_global = xbt_new0(s_SG_global_t, 1);
19 sg_global->workstations = xbt_dict_new();
20 sg_global->workstation_count = 0;
22 surf_init(argc, argv);
27 /* Creates the environnement described in a xml file of a platform descriptions.
29 void SG_create_environment(const char *platform_file) {
30 xbt_dict_cursor_t cursor = NULL;
32 void *workstation = NULL;
35 surf_timer_resource_init(platform_file);
36 surf_workstation_resource_init_KCCFLN05(platform_file); /* tell Surf to create the environnement */
38 /* now let's create the SG wrappers */
39 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
41 __SG_workstation_create(name, workstation, NULL);
46 /* Launches the simulation. Returns a NULL-terminated array of SG_task_t whose state has changed.
48 SG_task_t* SG_simulate(double how_long)
54 /* Destroys all SG data. This function should be called when the simulation is over.
58 xbt_dict_free(&sg_global->workstations);
61 /* TODO: destroy the workstations, the links and the tasks */