Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
introduce sg_actor_create and use it in C examples
[simgrid.git] / src / instr / instr_platform.cpp
index dc63425..fc6fde1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2020. 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. */
@@ -24,12 +24,17 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_routing, instr, "Tracing platform hierarch
 
 static std::vector<simgrid::instr::NetZoneContainer*> currentContainer; /* push and pop, used only in creation */
 
-static const char* instr_node_name(xbt_node_t node)
+std::string instr_pid(simgrid::s4u::Actor const& proc)
+{
+  return std::string(proc.get_name()) + "-" + std::to_string(proc.get_pid());
+}
+
+static const char* instr_node_name(const s_xbt_node_t* node)
 {
   return static_cast<char*>(xbt_graph_node_get_data(node));
 }
 
-static container_t lowestCommonAncestor(container_t a1, container_t a2)
+static container_t lowestCommonAncestor(const simgrid::instr::Container* a1, const simgrid::instr::Container* a2)
 {
   // this is only an optimization (since most of a1 and a2 share the same parent)
   if (a1->father_ == a2->father_)
@@ -106,9 +111,6 @@ static void linkContainers(container_t src, container_t dst, std::set<std::strin
   simgrid::instr::LinkType* link = father->type_->by_name_or_create(link_typename, src->type_, dst->type_);
   link->set_calling_container(father);
 
-  // register EDGE types for triva configuration
-  trivaEdgeTypes.insert(link->get_name());
-
   // create the link
   static long long counter = 0;
 
@@ -121,7 +123,7 @@ static void linkContainers(container_t src, container_t dst, std::set<std::strin
   XBT_DEBUG("  linkContainers %s <-> %s", src->get_cname(), dst->get_cname());
 }
 
-static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t container,
+static void recursiveGraphExtraction(const simgrid::s4u::NetZone* netzone, container_t container,
                                      std::set<std::string>* filter)
 {
   if (not TRACE_platform_topology()) {
@@ -490,8 +492,8 @@ void instr_new_value_for_user_state_type(const std::string& type_name, const cha
 
 #define GRAPHICATOR_SUPPORT_FUNCTIONS
 
-static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
-                                        std::map<std::string, xbt_edge_t>* edges, sg_netzone_t netzone,
+static void recursiveXBTGraphExtraction(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
+                                        std::map<std::string, xbt_edge_t>* edges, const_sg_netzone_t netzone,
                                         container_t container)
 {
   if (not netzone->get_children().empty()) {
@@ -517,7 +519,7 @@ xbt_graph_t instr_routing_platform_graph()
   return ret;
 }
 
-void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename)
+void instr_routing_platform_graph_export_graphviz(const s_xbt_graph_t* g, const char* filename)
 {
   unsigned int cursor = 0;
   xbt_node_t node     = nullptr;