Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
have a on_completion per activity type to save users some dynamic_cast-based filtering
[simgrid.git] / src / instr / instr_interface.cpp
index 20a9c89..106acd4 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. */
@@ -17,11 +17,11 @@ enum class InstrUserVariable { DECLARE, SET, ADD, SUB };
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
 
-std::set<std::string, std::less<>> created_categories;
-std::set<std::string, std::less<>> declared_marks;
-std::set<std::string, std::less<>> user_host_variables;
-std::set<std::string, std::less<>> user_vm_variables;
-std::set<std::string, std::less<>> user_link_variables;
+static std::set<std::string, std::less<>> created_categories;
+static std::set<std::string, std::less<>> declared_marks;
+static std::set<std::string, std::less<>> user_host_variables;
+static std::set<std::string, std::less<>> user_vm_variables;
+static std::set<std::string, std::less<>> user_link_variables;
 
 static void instr_user_variable(double time, const std::string& resource, const std::string& variable_name,
                                 const std::string& parent_type, double value, InstrUserVariable what,
@@ -75,8 +75,7 @@ static void instr_user_srcdst_variable(double time, const std::string& src, cons
     instr_user_variable(time, link->get_cname(), variable, "LINK", value, what, "", &user_link_variables);
 }
 
-namespace simgrid {
-namespace instr {
+namespace simgrid::instr {
 /* for host variables */
 /** @brief Declare a new user variable associated to hosts.
  *
@@ -313,7 +312,7 @@ void declare_tracing_category(const std::string& name, const std::string& color)
     double blue  = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
     final_color  = std::to_string(red) + " " + std::to_string(green) + " " + std::to_string(blue);
   } else {
-    final_color = std::string(color);
+    final_color = color;
   }
 
   XBT_DEBUG("CAT,declare %s, \"%s\" \"%s\"", name.c_str(), color.c_str(), final_color.c_str());
@@ -331,8 +330,7 @@ const std::set<std::string, std::less<>>& get_tracing_categories()
   return created_categories;
 }
 
-} // namespace instr
-} // namespace simgrid
+} // namespace simgrid::instr
 
 static xbt_dynar_t instr_set_to_dynar(const std::set<std::string, std::less<>>& filter) // XBT_ATTRIB_DEPRECATED_v334
 {