Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / kernel / resource / profile / Profile.cpp
index a00d6bc..e0f4722 100644 (file)
@@ -1,14 +1,13 @@
-/* Copyright (c) 2004-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-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. */
 
 #include "src/kernel/resource/profile/Profile.hpp"
-#include "xbt/asserts.h"
 #include "src/kernel/resource/profile/Event.hpp"
 #include "src/kernel/resource/profile/FutureEvtSet.hpp"
 #include "src/kernel/resource/profile/StochasticDatedValue.hpp"
-#include "src/surf/surf_interface.hpp"
+#include "xbt/asserts.h"
 
 #include <boost/algorithm/string.hpp>
 #include <fstream>
@@ -22,9 +21,7 @@
 
 static std::unordered_map<std::string, simgrid::kernel::profile::Profile*> trace_list;
 
-namespace simgrid {
-namespace kernel {
-namespace profile {
+namespace simgrid::kernel::profile {
 
 /** @brief Register this profile for that resource onto that FES,
  * and get an iterator over the integrated trace  */
@@ -71,18 +68,16 @@ Profile::Profile(const std::string& name, const std::function<ProfileBuilder::Up
     : name(name), cb(cb), repeat_delay(repeat_delay)
 {
   xbt_assert(trace_list.find(name) == trace_list.end(), "Refusing to define trace %s twice", name.c_str());
-  trace_list.insert({name,this});
+  trace_list.try_emplace(name, this);
   get_enough_events(0);
 }
 
-} // namespace profile
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::profile
 
 void tmgr_finalize()
 {
-  for (auto const& kv : trace_list)
-    delete kv.second;
+  for (auto const& [_, trace] : trace_list)
+    delete trace;
   trace_list.clear();
 }