Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Energy, onHostDestruction: ensured ptr existence
[simgrid.git] / examples / simdag / metaxml / sd_meta.c
index d2a54f2..2b3da2a 100644 (file)
@@ -1,14 +1,20 @@
-/*
-   See examples/platforms/metaxml.xml and examples/platforms/metaxml_platform.xml files for examples on how to use the cluster, foreach, set, route:multi, trace and trace:connect tags
+/* Copyright (c) 2007-2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+/* See examples/platforms/metaxml.xml and examples/platforms/metaxml_platform.xml 
+   for examples on how to use the cluster, foreach, set, route:multi, trace and trace:connect tags
 */
+
 #include <stdio.h>
 #include <stdlib.h>
-#include "simdag/simdag.h"
+#include "simgrid/simdag.h"
 #include "xbt/ex.h"
 #include "xbt/log.h"
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
-#include "xbt/time.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
                              "Logging specific to this SimDag example");
@@ -17,21 +23,21 @@ int main(int argc, char **argv)
 {
 
   const char *platform_file;
-  const SD_workstation_t *workstations;
+  const sg_host_t *workstations;
   int ws_nr;
-  SD_workstation_t w1 = NULL;
-  SD_workstation_t w2 = NULL;
+  sg_host_t w1 = NULL;
+  sg_host_t w2 = NULL;
   const char *name1, *name2;
   int i, j, k;
 
-  /* initialisation of SD */
+  /* SD initialization */
   SD_init(&argc, argv);
 
   /*  xbt_log_control_set("sd.thres=debug"); */
 
   if (argc < 2) {
-    INFO1("Usage: %s platform_file", argv[0]);
-    INFO1("example: %s sd_platform.xml", argv[0]);
+    XBT_INFO("Usage: %s platform_file", argv[0]);
+    XBT_INFO("example: %s sd_platform.xml", argv[0]);
     exit(1);
   }
 
@@ -40,8 +46,8 @@ int main(int argc, char **argv)
   SD_create_environment(platform_file);
 
   /* test the estimation functions */
-  workstations = SD_workstation_get_list();
-  ws_nr = SD_workstation_get_number();
+  workstations = sg_host_list();
+  ws_nr = sg_host_count();
 
 
   /* Show routes between all workstation */
@@ -52,16 +58,16 @@ int main(int argc, char **argv)
       int route_size;
       w1 = workstations[i];
       w2 = workstations[j];
-      name1 = SD_workstation_get_name(w1);
-      name2 = SD_workstation_get_name(w2);
-      INFO2("Route between %s and %s:", name1, name2);
+      name1 = sg_host_get_name(w1);
+      name2 = sg_host_get_name(w2);
+      XBT_INFO("Route between %s and %s:", name1, name2);
       route = SD_route_get_list(w1, w2);
       route_size = SD_route_get_size(w1, w2);
       for (k = 0; k < route_size; k++) {
-        INFO3("\tLink %s: latency = %f, bandwidth = %f",
-              SD_link_get_name(route[k]),
-              SD_link_get_current_latency(route[k]),
-              SD_link_get_current_bandwidth(route[k]));
+        XBT_INFO("\tLink %s: latency = %f, bandwidth = %f",
+              sg_link_name(route[k]),
+              sg_link_latency(route[k]),
+              sg_link_bandwidth(route[k]));
       }
     }
   }