Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
woops revalidate some tesh files
[simgrid.git] / examples / simdag / scheduling / minmin_test.c
index 97947d0..2d60522 100644 (file)
@@ -1,6 +1,6 @@
 /* simple test to schedule a DAX file with the Min-Min algorithm.           */
 
-/* Copyright (c) 2009-2012. The SimGrid Team.
+/* Copyright (c) 2009-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -8,7 +8,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include "simdag/simdag.h"
+#include "simgrid/simdag.h"
 #include "xbt/log.h"
 #include "xbt/ex.h"
 #include <string.h>
@@ -18,7 +18,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test,
 
 typedef struct _WorkstationAttribute *WorkstationAttribute;
 struct _WorkstationAttribute {
-  /* Earliest time at wich a workstation is ready to execute a task */
+  /* Earliest time at which a workstation is ready to execute a task */
   double available_at;
   SD_task_t last_scheduled_task;
 };
@@ -157,7 +157,7 @@ static SD_workstation_t SD_task_get_best_workstation(SD_task_t task)
   int i;
   double EFT, min_EFT = -1.0;
   const SD_workstation_t *workstations = SD_workstation_get_list();
-  int nworkstations = SD_workstation_get_number();
+  int nworkstations = SD_workstation_get_count();
   SD_workstation_t best_workstation;
 
   best_workstation = workstations[0];
@@ -182,7 +182,7 @@ static void output_xml(FILE * out, xbt_dynar_t dax)
 {
   unsigned int i, j, k;
   int current_nworkstations;
-  const int nworkstations = SD_workstation_get_number();
+  const int nworkstations = SD_workstation_get_count();
   const SD_workstation_t *workstations = SD_workstation_get_list();
   SD_task_t task;
   SD_workstation_t *list;
@@ -254,7 +254,7 @@ int main(int argc, char **argv)
   SD_workstation_t workstation, selected_workstation = NULL;
   int total_nworkstations = 0;
   const SD_workstation_t *workstations = NULL;
-  xbt_dynar_t dax, changed;
+  xbt_dynar_t dax;
   FILE *out = NULL;
 
   /* initialization of SD */
@@ -284,7 +284,7 @@ int main(int argc, char **argv)
   SD_create_environment(argv[1]);
 
   /*  Allocating the workstation attribute */
-  total_nworkstations = SD_workstation_get_number();
+  total_nworkstations = SD_workstation_get_count();
   workstations = SD_workstation_get_list();
 
   for (cursor = 0; cursor < total_nworkstations; cursor++)
@@ -303,12 +303,11 @@ int main(int argc, char **argv)
   workstation = SD_task_get_best_workstation(task);
   SD_task_schedulel(task, 1, workstation);
 
-  while (!xbt_dynar_is_empty((changed = SD_simulate(-1.0)))) {
+  while (!xbt_dynar_is_empty(SD_simulate(-1.0))) {
     /* Get the set of ready tasks */
     ready_tasks = get_ready_tasks(dax);
     if (xbt_dynar_is_empty(ready_tasks)) {
       xbt_dynar_free_container(&ready_tasks);
-      xbt_dynar_free_container(&changed);
       /* there is no ready task, let advance the simulation */
       continue;
     }
@@ -362,7 +361,6 @@ int main(int argc, char **argv)
     xbt_dynar_free_container(&ready_tasks);
     /* reset the min_finish_time for the next set of ready tasks */
     min_finish_time = -1.;
-    xbt_dynar_free_container(&changed);
   }
 
   XBT_INFO("Simulation Time: %f", SD_get_clock());
@@ -383,7 +381,6 @@ int main(int argc, char **argv)
 
 
   xbt_dynar_free_container(&ready_tasks);
-  xbt_dynar_free_container(&changed);
 
   xbt_dynar_foreach(dax, cursor, task) {
     SD_task_destroy(task);