Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / smpi / internals / instr_smpi.cpp
index 57ac211..b55f098 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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,6 +15,8 @@
 #include <string>
 #include <vector>
 
+#include "src/smpi/include/smpi_actor.hpp"
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_smpi, instr, "Tracing SMPI");
 
 static std::unordered_map<std::string, std::deque<std::string>*> keys;
@@ -137,6 +138,8 @@ static std::string TRACE_smpi_get_key(int src, int dst, int tag, int send)
   } else {
     key = it->second->front();
     it->second->pop_front();
+    if (it->second->empty())
+      keys.erase(it);
   }
   return key;
 }
@@ -187,7 +190,7 @@ void TRACE_smpi_init(int rank)
 
   TRACE_smpi_setup_container(rank, sg_host_self());
 #if HAVE_PAPI
-  container_t container   = simgrid::instr::Container::by_name(str);
+  container_t container   = smpi_container(rank);
   papi_counter_t counters = smpi_process()->papi_counters();
 
   for (auto const& it : counters) {
@@ -195,9 +198,7 @@ void TRACE_smpi_init(int rank)
      * Check whether this variable already exists or not. Otherwise, it will be created
      * multiple times but only the last one would be used...
      */
-    if (s_type::getOrNull(it.first.c_str(), container->type_) == nullptr) {
-      Type::variableNew(it.first.c_str(), "", container->type_);
-    }
+    container->type_->by_name_or_create(it.first, "");
   }
 #endif
 }