Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Now it works (if you don't look at the leaks)
[simgrid.git] / src / surf / instr_routing.cpp
index 6077a30..ed9411b 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "simgrid/s4u/engine.hpp"
 #include "simgrid/s4u/host.hpp"
-
 #include "src/kernel/routing/NetZoneImpl.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf_private.hpp"
@@ -121,8 +120,8 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter)
   snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter);
   counter++;
 
-  new_pajeStartLink(SIMIX_get_clock(), father, link_type, src, "topology", key);
-  new_pajeEndLink(SIMIX_get_clock(), father, link_type, dst, "topology", key);
+  new StartLinkEvent(SIMIX_get_clock(), father, link_type, src, "topology", key);
+  new EndLinkEvent(SIMIX_get_clock(), father, link_type, dst, "topology", key);
 
   XBT_DEBUG ("  linkContainers %s <-> %s", src->name, dst->name);
 }
@@ -134,12 +133,9 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
     return;
   }
   XBT_DEBUG("Graph extraction for NetZone = %s", netzone->name());
-  if (!xbt_dict_is_empty(netzone->children())) {
-    xbt_dict_cursor_t cursor = nullptr;
-    sg_netzone_t nz_son;
-    char *child_name;
+  if (!netzone->children()->empty()) {
     //bottom-up recursion
-    xbt_dict_foreach (netzone->children(), cursor, child_name, nz_son) {
+    for (auto nz_son : *netzone->children()) {
       container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, nz_son->name()));
       recursiveGraphExtraction(nz_son, child_container, filter);
     }
@@ -227,8 +223,8 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link)
     if (latency == nullptr) {
       latency = PJ_type_variable_new("latency", nullptr, container->type);
     }
-    new_pajeSetVariable(0, container, bandwidth, bandwidth_value);
-    new_pajeSetVariable(0, container, latency, latency_value);
+    new SetVariableEvent(0, container, bandwidth, bandwidth_value);
+    new SetVariableEvent(0, container, latency, latency_value);
   }
   if (TRACE_uncategorized()) {
     type_t bandwidth_used = PJ_type_get_or_null("bandwidth_used", container->type);
@@ -249,8 +245,8 @@ void sg_instr_new_host(simgrid::s4u::Host& host)
       speed = PJ_type_variable_new ("power", nullptr, container->type);
     }
 
-    double current_speed_state = host.getPstateSpeedCurrent();
-    new_pajeSetVariable (0, container, speed, current_speed_state);
+    double current_speed_state = host.speed();
+    new SetVariableEvent (0, container, speed, current_speed_state);
   }
   if (TRACE_uncategorized()){
     type_t speed_used = PJ_type_get_or_null ("power_used", container->type);
@@ -426,12 +422,9 @@ int instr_platform_traced ()
 static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, sg_netzone_t netzone,
                                         container_t container)
 {
-  if (!xbt_dict_is_empty(netzone->children())) {
-    xbt_dict_cursor_t cursor = nullptr;
-    sg_netzone_t netzone_child;
-    char *child_name;
+  if (!netzone->children()->empty()) {
     //bottom-up recursion
-    xbt_dict_foreach (netzone->children(), cursor, child_name, netzone_child) {
+    for (auto netzone_child : *netzone->children()) {
       container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, netzone_child->name()));
       recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
     }