Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
create a singleton for s4u::Engine
[simgrid.git] / src / instr / instr_interface.cpp
index 290bd88..5be023c 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "simgrid_config.h"
 
+#include "src/surf/network_interface.hpp"
 #include "src/instr/instr_private.h"
 #include "surf/surf.h"
 #include "src/surf/surf_private.h"
@@ -363,20 +364,17 @@ static void instr_user_srcdst_variable(double time,
                               double value,
                               InstrUserVariable what)
 {
-  xbt_dynar_t route=NULL;
   sg_netcard_t src_elm = sg_netcard_by_name_or_null(src);
   if(!src_elm) xbt_die("Element '%s' not found!",src);
 
   sg_netcard_t dst_elm = sg_netcard_by_name_or_null(dst);
   if(!dst_elm) xbt_die("Element '%s' not found!",dst);
 
-  routing_get_route_and_latency (src_elm, dst_elm, &route,NULL);
-  unsigned int i;
-  surf_cpp_resource_t link;
-  xbt_dynar_foreach (route, i, link) {
-    char *link_name = (char*)surf_resource_name(link);
-    instr_user_variable (time, link_name, variable, father_type, value, what, NULL, user_link_variables);
-  }
+  std::vector<Link*> *route = new std::vector<Link*>();
+  routing_platf->getRouteAndLatency (src_elm, dst_elm, route,NULL);
+  for (auto link : *route)
+    instr_user_variable (time, link->getName(), variable, father_type, value, what, NULL, user_link_variables);
+  delete route;
 }
 
 /** \ingroup TRACE_API