Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'actor-yield' of github.com:Takishipp/simgrid into actor-yield
[simgrid.git] / src / instr / instr_paje_containers.cpp
index e5342cf..ce66709 100644 (file)
@@ -27,7 +27,7 @@ long long int instr_new_paje_id ()
 namespace simgrid {
 namespace instr {
 
-container_t Container::getRootContainer()
+container_t Container::getRoot()
 {
   return rootContainer;
 }
@@ -107,7 +107,7 @@ Container::~Container()
   TRACE_paje_dump_buffer(true);
 
   // trace my destruction, but not if user requests so or if the container is root
-  if (not TRACE_disable_destroy() && this != Container::getRootContainer())
+  if (not TRACE_disable_destroy() && this != Container::getRoot())
     logDestruction();
 
   // remove me from the allContainers data structure
@@ -164,19 +164,16 @@ void Container::logCreation()
     }
 
     if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) {
-      char* folder_name = bprintf("%s_files", TRACE_get_filename());
-      char* filename    = bprintf("%s/%f_%s.txt", folder_name, prefix, name_.c_str());
+      std::string folder_name = TRACE_get_filename() + "_files";
+      std::string filename    = folder_name + "/" + std::to_string(prefix) + "_" + name_ + ".txt";
 #ifdef WIN32
-      _mkdir(folder_name);
+      _mkdir(folder_name.c_str());
 #else
-      mkdir(folder_name, S_IRWXU | S_IRWXG | S_IRWXO);
+      mkdir(folder_name.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
 #endif
-      ti_unique_file = fopen(filename, "w");
-      xbt_assert(ti_unique_file, "Tracefile %s could not be opened for writing: %s", filename, strerror(errno));
-      fprintf(tracing_file, "%s\n", filename);
-
-      xbt_free(folder_name);
-      xbt_free(filename);
+      ti_unique_file = fopen(filename.c_str(), "w");
+      xbt_assert(ti_unique_file, "Tracefile %s could not be opened for writing: %s", filename.c_str(), strerror(errno));
+      fprintf(tracing_file, "%s\n", filename.c_str());
     }
     tracing_files.insert({this, ti_unique_file});
   } else {
@@ -219,7 +216,9 @@ StateType* Container::getState(std::string name)
 
 LinkType* Container::getLink(std::string name)
 {
-  return dynamic_cast<LinkType*>(type_->byName(name));
+  LinkType* ret = dynamic_cast<LinkType*>(type_->byName(name));
+  ret->setCallingContainer(this);
+  return ret;
 }
 
 VariableType* Container::getVariable(std::string name)