allContainers.erase(name_);
}
+void Container::createChild(std::string name, std::string type_name)
+{
+ new Container(name, type_name, this);
+}
+
Container* Container::byNameOrNull(std::string name)
{
auto cont = allContainers.find(name);
XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", getCname(), father_->getCname());
father_->children_.erase(name_);
}
+ delete this;
}
void Container::logCreation()
double timestamp = SIMIX_get_clock();
std::stringstream stream;
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, PAJE_CreateContainer, timestamp);
+ XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, timestamp);
if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_CreateContainer << " ";
}
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 {
std::stringstream stream;
double timestamp = SIMIX_get_clock();
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp);
+ XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_DestroyContainer, timestamp);
if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DestroyContainer << " ";