Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'udpor-phase6' into 'master'
[simgrid.git] / src / instr / instr_platform.cpp
index 0db7a14..694a04a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2023. 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. */
@@ -16,7 +16,6 @@
 #include "src/instr/instr_private.hpp"
 #include "src/kernel/resource/CpuImpl.hpp"
 #include "src/kernel/resource/NetworkModel.hpp"
-#include "src/surf/surf_interface.hpp"
 
 #include <fstream>
 
@@ -24,7 +23,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_routing, instr, "Tracing platform hierarch
 
 std::string instr_pid(simgrid::s4u::Actor const& proc)
 {
-  return std::string(proc.get_name()) + "-" + std::to_string(proc.get_pid());
+  return proc.get_name() + "-" + std::to_string(proc.get_pid());
 }
 
 static simgrid::instr::Container* lowestCommonAncestor(const simgrid::instr::Container* a1,
@@ -142,10 +141,10 @@ static void recursiveNewVariableType(const std::string& new_typename, const std:
                                      simgrid::instr::Type* root)
 {
   if (root->get_name() == "HOST" || root->get_name() == "VM")
-    root->by_name_or_create(std::string("p") + new_typename, color);
+    root->by_name_or_create("p" + new_typename, color);
 
   if (root->get_name() == "LINK")
-    root->by_name_or_create(std::string("b") + new_typename, color);
+    root->by_name_or_create("b" + new_typename, color);
 
   for (auto const& [_, child] : root->get_children()) {
     recursiveNewVariableType(new_typename, color, child.get());
@@ -450,9 +449,11 @@ void define_callbacks()
     s4u::Link::on_bandwidth_change_cb([](s4u::Link const& link) {
       Container::by_name(link.get_name())
           ->get_variable("bandwidth")
-          ->set_event(simgrid_get_clock(), sg_bandwidth_factor * link.get_bandwidth());
+          ->set_event(
+              simgrid_get_clock(),
+              static_cast<kernel::resource::NetworkModel*>(link.get_impl()->get_model())->get_bandwidth_factor() *
+                  link.get_bandwidth());
     });
-    s4u::NetZone::on_seal_cb([](s4u::NetZone const& /*netzone*/) { currentContainer.pop_back(); });
     kernel::routing::NetPoint::on_creation.connect([](kernel::routing::NetPoint const& netpoint) {
       if (netpoint.is_router())
         new RouterContainer(netpoint.get_name(), currentContainer.back());
@@ -498,14 +499,12 @@ void define_callbacks()
 
   if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing()) {
     s4u::Exec::on_start_cb([](s4u::Exec const& exec) {
-      Container::by_name(std::string("rank-") + std::to_string(s4u::Actor::self()->get_pid()))
+      Container::by_name("rank-" + std::to_string(s4u::Actor::self()->get_pid()))
           ->get_state("MPI_STATE")
           ->push_event("computing", new CpuTIData("compute", exec.get_cost()));
     });
     s4u::Activity::on_completion_cb([](const s4u::Activity&) {
-      Container::by_name(std::string("rank-") + std::to_string(s4u::Actor::self()->get_pid()))
-          ->get_state("MPI_STATE")
-          ->pop_event();
+      Container::by_name("rank-" + std::to_string(s4u::Actor::self()->get_pid()))->get_state("MPI_STATE")->pop_event();
     });
   }