static std::stringstream stream;
FILE *tracing_file = nullptr;
-static xbt_dict_t tracing_files = nullptr; // TI specific
+static std::map<container_t, FILE*> tracing_files; // TI specific
static double prefix=0.0; // TI specific
std::vector<simgrid::instr::PajeEvent*> buffer;
void LogVariableTypeDefinition(simgrid::instr::Type* type)
{
-
XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType);
//print it
-if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType,
- TRACE_precision(), 0.);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << simgrid::instr::PAJE_DefineVariableType;
- stream << " " << type->id_ << " " << type->father_->id_ << " " << type->name_;
- if (type->color_)
- stream << " \"" << type->color_ << "\"";
- print_row();
+ if (instr_fmt_type == instr_fmt_paje) {
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType,
+ TRACE_precision(), 0.);
+ stream << std::fixed << std::setprecision(TRACE_precision());
+ stream << simgrid::instr::PAJE_DefineVariableType;
+ stream << " " << type->id_ << " " << type->father_->id_ << " " << type->name_;
+ if (type->color_)
+ stream << " \"" << type->color_ << "\"";
+ print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
} else {
}
}
-
void LogContainerCreation (container_t container)
{
double timestamp = SIMIX_get_clock();
// if we are in the mode with only one file
static FILE* ti_unique_file = nullptr;
- if (tracing_files == nullptr) {
- tracing_files = xbt_dict_new_homogeneous(nullptr);
+ if (tracing_files.empty()) {
// generate unique run id with time
prefix = xbt_os_time();
}
xbt_free(filename);
}
- xbt_dict_set(tracing_files, container->name_, (void*)ti_unique_file, nullptr);
+ tracing_files.insert({container, ti_unique_file});
} else {
THROW_IMPOSSIBLE;
}
stream << " " << container->type_->id_ << " " << container->id_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
- if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || xbt_dict_length(tracing_files) == 1) {
- FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, container->name_);
+ if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) {
+ FILE* f = tracing_files.at(container);
fclose(f);
}
- xbt_dict_remove(tracing_files, container->name_);
- } else {
- THROW_IMPOSSIBLE;
- }
+ tracing_files.erase(container);
+ } else {
+ THROW_IMPOSSIBLE;
+ }
}
simgrid::instr::SetVariableEvent::SetVariableEvent(double timestamp, container_t container, Type* type, double value)
else
process_id = xbt_strdup(container->name_ + 5);
- FILE* trace_file = (FILE*)xbt_dict_get(tracing_files, container->name_);
+ FILE* trace_file = tracing_files.at(container);
switch (extra->type) {
case TRACING_INIT:
}
}
-
void TRACE_TI_start()
{
char *filename = TRACE_get_filename();
void TRACE_TI_end()
{
- xbt_dict_free(&tracing_files);
fclose(tracing_file);
char *filename = TRACE_get_filename();
XBT_DEBUG("Filename %s is closed", filename);
}
-