1 #include "simdag/simdag.h"
3 #include "xbt/asserts.h"
4 #include "xbt/sysdep.h"
7 SD_global_t sd_global = NULL;
9 /* Initialises SD internal data. This function should be called before any other SD function.
11 void SD_init(int *argc, char **argv) {
12 xbt_assert0(sd_global == NULL, "SD_init already called");
14 sd_global = xbt_new0(s_SD_global_t, 1);
15 sd_global->workstations = xbt_dict_new();
16 sd_global->workstation_count = 0;
18 surf_init(argc, argv);
21 /* Creates the environnement described in a xml file of a platform descriptions.
23 void SD_create_environment(const char *platform_file) {
24 xbt_dict_cursor_t cursor = NULL;
26 void *surf_workstation = NULL;
29 surf_timer_resource_init(platform_file);
30 surf_workstation_resource_init_KCCFLN05(platform_file); /* tell Surf to create the environnement */
32 /* now let's create the SD wrappers */
33 xbt_dict_foreach(workstation_set, cursor, name, surf_workstation) {
34 __SD_workstation_create(surf_workstation, NULL);
38 /* Launches the simulation. Returns a NULL-terminated array of SD_task_t whose state has changed.
40 SD_task_t* SD_simulate(double how_long)
44 /* temporary test to explore the workstations */
45 xbt_dict_cursor_t cursor = NULL;
47 SD_workstation_t workstation = NULL;
50 xbt_dict_foreach(sd_global->workstations, cursor, name, workstation) {
51 power = SD_workstation_get_power(workstation);
52 printf("Workstation name: %s, power: %f Mflop/s\n", name, power);
54 /* TODO: remove name from SD workstation structure */
59 /* Destroys all SD data. This function should be called when the simulation is over.
62 if (sd_global != NULL) {
63 xbt_dict_free(&sd_global->workstations);
66 /* TODO: destroy the workstations, the links and the tasks */