Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get rid of kind field in instr Type
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 26 Oct 2017 17:14:46 +0000 (19:14 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 26 Oct 2017 17:14:46 +0000 (19:14 +0200)
use derived classes and some casts instead

src/instr/instr_interface.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_private.hpp
src/msg/instr_msg_process.cpp
src/msg/instr_msg_task.cpp
src/msg/msg_vm.cpp
src/smpi/colls/smpi_automatic_selector.cpp
src/smpi/internals/instr_smpi.cpp
src/surf/instr_routing.cpp

index 3cea149..9ca67ce 100644 (file)
@@ -186,7 +186,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar
       mark_color = "1.0 1.0 1.0" /*white*/;
 
     XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
       mark_color = "1.0 1.0 1.0" /*white*/;
 
     XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
-    type->addEntityValue(mark_value, mark_color);
+    static_cast<simgrid::instr::EventType*>(type)->addEntityValue(mark_value, mark_color);
   }
 }
 
   }
 }
 
@@ -233,7 +233,8 @@ void TRACE_mark(const char *mark_type, const char *mark_value)
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
   //check if mark_type is already declared
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
   //check if mark_type is already declared
-  simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName(mark_type);
+  simgrid::instr::EventType* type =
+      static_cast<simgrid::instr::EventType*>(simgrid::instr::Type::getRootType()->byName(mark_type));
   if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   } else {
   if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   } else {
@@ -940,7 +941,7 @@ void TRACE_host_state_declare_value (const char *state, const char *value, const
 void TRACE_host_set_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container       = simgrid::instr::Container::byName(host);
 void TRACE_host_set_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container       = simgrid::instr::Container::byName(host);
-  simgrid::instr::Type* state = container->type_->byName(state_name);
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName(state_name));
   state->addEntityValue(value_name);
   new simgrid::instr::SetStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
 }
   state->addEntityValue(value_name);
   new simgrid::instr::SetStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
 }
@@ -959,7 +960,7 @@ void TRACE_host_set_state(const char* host, const char* state_name, const char*
 void TRACE_host_push_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container      = simgrid::instr::Container::byName(host);
 void TRACE_host_push_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container      = simgrid::instr::Container::byName(host);
-  simgrid::instr::Type* state = container->type_->byName(state_name);
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName(state_name));
   state->addEntityValue(value_name);
   new simgrid::instr::PushStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
 }
   state->addEntityValue(value_name);
   new simgrid::instr::PushStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
 }
index 973f6d0..24d6450 100644 (file)
@@ -178,97 +178,6 @@ void TRACE_paje_end() {
   XBT_DEBUG("Filename %s is closed", filename);
 }
 
   XBT_DEBUG("Filename %s is closed", filename);
 }
 
-void simgrid::instr::Type::logContainerTypeDefinition()
-{
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineContainerType);
-  //print it
-  if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineContainerType,
-              TRACE_precision(), 0.);
-    stream << std::fixed << std::setprecision(TRACE_precision());
-    stream << simgrid::instr::PAJE_DefineContainerType;
-    stream << " " << id_ << " " << father_->getId() << " " << name_;
-    print_row();
-  } else if (instr_fmt_type == instr_fmt_TI) {
-    /* Nothing to do */
-  } else {
-    THROW_IMPOSSIBLE;
-  }
-}
-
-void simgrid::instr::Type::logVariableTypeDefinition()
-{
-  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 << " " << id_ << " " << father_->getId() << " " << name_;
-    if (isColored())
-      stream << " \"" << color_ << "\"";
-    print_row();
-  } else if (instr_fmt_type == instr_fmt_TI) {
-    /* Nothing to do */
-  } else {
-    THROW_IMPOSSIBLE;
-  }
-}
-
-void simgrid::instr::Type::logStateTypeDefinition()
-{
-  //print it
-  if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineStateType,
-              TRACE_precision(), 0.);
-    stream << std::fixed << std::setprecision(TRACE_precision());
-    stream << simgrid::instr::PAJE_DefineStateType;
-    stream << " " << id_ << " " << father_->getId() << " " << name_;
-    print_row();
-  } else if (instr_fmt_type == instr_fmt_TI) {
-    /* Nothing to do */
-  } else {
-    THROW_IMPOSSIBLE;
-  }
-}
-
-void simgrid::instr::Type::logDefineEventType()
-{
-  //print it
-  if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineEventType,
-              TRACE_precision(), 0.);
-    stream << std::fixed << std::setprecision(TRACE_precision());
-    stream << simgrid::instr::PAJE_DefineEventType;
-    stream << " " << id_ << " " << father_->getId() << " " << name_;
-    print_row();
-  } else if (instr_fmt_type == instr_fmt_TI) {
-    /* Nothing to do */
-  } else {
-    THROW_IMPOSSIBLE;
-  }
-}
-
-void simgrid::instr::Type::logLinkTypeDefinition(simgrid::instr::Type* source, simgrid::instr::Type* dest)
-{
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineLinkType);
-  //print it
-  if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineLinkType, TRACE_precision(),
-              0.);
-    stream << std::fixed << std::setprecision(TRACE_precision());
-    stream << simgrid::instr::PAJE_DefineLinkType;
-    stream << " " << id_ << " " << father_->getId() << " " << source->getId() << " " << dest->getId() << " " << name_;
-    print_row();
-  } else if (instr_fmt_type == instr_fmt_TI) {
-    /* Nothing to do */
-  } else {
-    THROW_IMPOSSIBLE;
-  }
-}
-
 void simgrid::instr::Value::print()
 {
   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineEntityValue);
 void simgrid::instr::Value::print()
 {
   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineEntityValue);
index a6e5a95..2cbd8d8 100644 (file)
@@ -8,19 +8,17 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)");
 
-static simgrid::instr::Type* rootType = nullptr; /* the root type */
+static simgrid::instr::ContainerType* rootType = nullptr; /* the root type */
+extern FILE* tracing_file;
 
 namespace simgrid {
 namespace instr {
 
 
 namespace simgrid {
 namespace instr {
 
-Type::Type(std::string name, std::string alias, std::string color, e_entity_types kind, Type* father)
-    : name_(name), color_(color), kind_(kind), father_(father)
+Type::Type(std::string name, std::string alias, std::string color, Type* father)
+    : id_(instr_new_paje_id()), name_(name), color_(color), father_(father)
 {
 {
-  if (name.empty() || alias.empty()) {
+  if (name.empty() || alias.empty())
     THROWF(tracing_error, 0, "can't create a new type with no name or alias");
     THROWF(tracing_error, 0, "can't create a new type with no name or alias");
-  }
-
-  id_ = std::to_string(instr_new_paje_id());
 
   if (father != nullptr){
     father->children_.insert({alias, this});
 
   if (father != nullptr){
     father->children_.insert({alias, this});
@@ -30,12 +28,72 @@ Type::Type(std::string name, std::string alias, std::string color, e_entity_type
 
 Type::~Type()
 {
 
 Type::~Type()
 {
-  for (auto elm : values_)
-    delete elm.second;
   for (auto elm : children_)
     delete elm.second;
 }
 
   for (auto elm : children_)
     delete elm.second;
 }
 
+ValueType::~ValueType()
+{
+  for (auto elm : values_)
+    delete elm.second;
+}
+
+ContainerType::ContainerType(std::string name, Type* father) : Type(name, name, "", father)
+{
+  XBT_DEBUG("ContainerType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId());
+  logDefinition(PAJE_DefineContainerType);
+}
+
+EventType::EventType(std::string name, Type* father) : ValueType(name, father)
+{
+  XBT_DEBUG("EventType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId());
+  logDefinition(PAJE_DefineEventType);
+}
+
+StateType::StateType(std::string name, Type* father) : ValueType(name, father)
+{
+  XBT_DEBUG("StateType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId());
+  logDefinition(PAJE_DefineStateType);
+}
+
+VariableType::VariableType(std::string name, std::string color, Type* father) : Type(name, name, color, father)
+{
+  XBT_DEBUG("VariableType %s(%lld), child of %s(%lld)", getCname(), getId(), father->getCname(), father->getId());
+  logDefinition(PAJE_DefineVariableType);
+}
+
+LinkType::LinkType(std::string name, std::string alias, Type* father) : ValueType(name, alias, father)
+{
+}
+
+void Type::logDefinition(e_event_type event_type)
+{
+  if (instr_fmt_type != instr_fmt_paje)
+    return;
+  std::stringstream stream;
+  XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, event_type, TRACE_precision(), 0.);
+  stream << std::fixed << std::setprecision(TRACE_precision()) << event_type << " " << getId();
+  stream << " " << father_->getId() << " " << getName();
+  if (isColored())
+    stream << " \"" << color_ << "\"";
+  XBT_DEBUG("Dump %s", stream.str().c_str());
+  stream << std::endl;
+  fprintf(tracing_file, "%s", stream.str().c_str());
+}
+
+void Type::logDefinition(simgrid::instr::Type* source, simgrid::instr::Type* dest)
+{
+  if (instr_fmt_type != instr_fmt_paje)
+    return;
+  std::stringstream stream;
+  XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineLinkType, TRACE_precision(), 0.);
+  stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DefineLinkType << " " << getId();
+  stream << " " << father_->getId() << " " << source->getId() << " " << dest->getId() << " " << getName();
+  XBT_DEBUG("Dump %s", stream.str().c_str());
+  stream << std::endl;
+  fprintf(tracing_file, "%s", stream.str().c_str());
+}
+
 Type* Type::byName(std::string name)
 {
   Type* ret = nullptr;
 Type* Type::byName(std::string name)
 {
   Type* ret = nullptr;
@@ -53,29 +111,26 @@ Type* Type::byName(std::string name)
   return ret;
 }
 
   return ret;
 }
 
-void Type::addEntityValue(std::string name)
+void ValueType::addEntityValue(std::string name)
 {
   addEntityValue(name, "");
 }
 
 {
   addEntityValue(name, "");
 }
 
-void Type::addEntityValue(std::string name, std::string color)
+void ValueType::addEntityValue(std::string name, std::string color)
 {
 {
-  if (name.empty()) {
+  if (name.empty())
     THROWF(tracing_error, 0, "can't get a value with no name");
     THROWF(tracing_error, 0, "can't get a value with no name");
-  }
-  if (kind_ == TYPE_VARIABLE)
-    THROWF(tracing_error, 0, "variables can't have different values (%s)", getCname());
 
   auto it = values_.find(name);
   if (it == values_.end()) {
     Value* new_val = new Value(name, color, this);
     values_.insert({name, new_val});
 
   auto it = values_.find(name);
   if (it == values_.end()) {
     Value* new_val = new Value(name, color, this);
     values_.insert({name, new_val});
-    XBT_DEBUG("new value %s, child of %s", name_.c_str(), getCname());
+    XBT_DEBUG("new value %s, child of %s", name.c_str(), getCname());
     new_val->print();
   }
 }
 
     new_val->print();
   }
 }
 
-Value* Type::getEntityValue(std::string name)
+Value* ValueType::getEntityValue(std::string name)
 {
   auto ret = values_.find(name);
   if (ret == values_.end()) {
 {
   auto ret = values_.find(name);
   if (ret == values_.end()) {
@@ -84,81 +139,54 @@ Value* Type::getEntityValue(std::string name)
   return ret->second;
 }
 
   return ret->second;
 }
 
-Type* Type::createRootType()
+ContainerType* Type::createRootType()
 {
 {
-  simgrid::instr::Type* ret = new simgrid::instr::Type("0", "0", "", TYPE_CONTAINER, nullptr);
-  rootType                  = ret;
-  return ret;
+  rootType = static_cast<ContainerType*>(new simgrid::instr::Type("0", "0", "", nullptr));
+  return rootType;
 }
 
 }
 
-Type* Type::getRootType()
+ContainerType* Type::getRootType()
 {
   return rootType;
 }
 
 {
   return rootType;
 }
 
-Type* Type::getOrCreateContainerType(std::string name)
+ContainerType* Type::getOrCreateContainerType(std::string name)
 {
 {
-  auto it = children_.find(name);
-  if (it == children_.end()) {
-    Type* ret = new simgrid::instr::Type(name, name, "", TYPE_CONTAINER, this);
-    XBT_DEBUG("ContainerType %s(%s), child of %s(%s)", ret->getCname(), ret->getId(), getCname(), getId());
-    ret->logContainerTypeDefinition();
-    return ret;
-  } else
-    return it->second;
+  auto cont = children_.find(name);
+  return cont == children_.end() ? new ContainerType(name, this) : static_cast<ContainerType*>(cont->second);
 }
 
 }
 
-Type* Type::getOrCreateEventType(std::string name)
+EventType* Type::getOrCreateEventType(std::string name)
 {
 {
-  auto it = children_.find(name);
-  if (it == children_.end()) {
-    Type* ret = new Type(name, name, "", TYPE_EVENT, this);
-    XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->getCname(), ret->getId(), getCname(), getId());
-    ret->logDefineEventType();
-    return ret;
-  } else {
-    return it->second;
-  }
+  auto cont = children_.find(name);
+  return cont == children_.end() ? new EventType(name, this) : static_cast<EventType*>(cont->second);
 }
 
 }
 
-Type* Type::getOrCreateVariableType(std::string name, std::string color)
+StateType* Type::getOrCreateStateType(std::string name)
 {
 {
-  auto it = children_.find(name);
-  if (it == children_.end()) {
-    Type* ret = new Type(name, name, color.empty() ? "1 1 1" : color, TYPE_VARIABLE, this);
-
-    XBT_DEBUG("VariableType %s(%s), child of %s(%s)", ret->getCname(), ret->getId(), getCname(), getId());
-    ret->logVariableTypeDefinition();
-
-    return ret;
-  } else
-    return it->second;
+  auto cont = children_.find(name);
+  return cont == children_.end() ? new StateType(name, this) : static_cast<StateType*>(cont->second);
 }
 
 }
 
-Type* Type::getOrCreateLinkType(std::string name, Type* source, Type* dest)
+VariableType* Type::getOrCreateVariableType(std::string name, std::string color)
 {
 {
-  std::string alias = name + "-" + source->id_ + "-" + dest->id_;
-  auto it           = children_.find(alias);
-  if (it == children_.end()) {
-    Type* ret = new Type(name, alias, "", TYPE_LINK, this);
-    XBT_DEBUG("LinkType %s(%s), child of %s(%s)  %s(%s)->%s(%s)", ret->getCname(), ret->getId(), getCname(), getId(),
-              source->getCname(), source->getId(), dest->getCname(), dest->getId());
-    ret->logLinkTypeDefinition(source, dest);
-    return ret;
-  } else
-    return it->second;
+  auto cont = children_.find(name);
+  return cont == children_.end() ? new VariableType(name, color.empty() ? "1 1 1" : color, this)
+                                 : static_cast<VariableType*>(cont->second);
 }
 
 }
 
-Type* Type::getOrCreateStateType(std::string name)
+LinkType* Type::getOrCreateLinkType(std::string name, Type* source, Type* dest)
 {
 {
-  auto it = children_.find(name);
+  std::string alias = name + "-" + std::to_string(source->id_) + "-" + std::to_string(dest->id_);
+  auto it           = children_.find(alias);
   if (it == children_.end()) {
   if (it == children_.end()) {
-    Type* ret = new Type(name, name, "", TYPE_STATE, this);
-    XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->getCname(), ret->getId(), getCname(), getId());
-    ret->logStateTypeDefinition();
+    LinkType* ret = new LinkType(name, alias, this);
+    XBT_DEBUG("LinkType %s(%lld), child of %s(%lld)  %s(%lld)->%s(%lld)", ret->getCname(), ret->getId(), getCname(),
+              getId(), source->getCname(), source->getId(), dest->getCname(), dest->getId());
+    ret->logDefinition(source, dest);
     return ret;
   } else
     return ret;
   } else
-    return it->second;
+    return static_cast<LinkType*>(it->second);
 }
 }
 }
 }
 }
 }
index 4eb5eee..60bffc6 100644 (file)
@@ -30,6 +30,11 @@ namespace simgrid {
 namespace instr {
 
 class Value;
 namespace instr {
 
 class Value;
+class ContainerType;
+class EventType;
+class LinkType;
+class StateType;
+class VariableType;
 
 enum e_event_type {
   PAJE_DefineContainerType,
 
 enum e_event_type {
   PAJE_DefineContainerType,
@@ -52,49 +57,74 @@ enum e_event_type {
   PAJE_NewEvent
 };
 
   PAJE_NewEvent
 };
 
-//--------------------------------------------------
-enum e_entity_types { TYPE_VARIABLE, TYPE_LINK, TYPE_CONTAINER, TYPE_STATE, TYPE_EVENT };
-
 class Type {
 class Type {
-  std::string id_;
+  long long int id_;
   std::string name_;
   std::string color_;
   std::string name_;
   std::string color_;
-  e_entity_types kind_;
+
+protected:
   Type* father_;
 
 public:
   std::map<std::string, Type*> children_;
   Type* father_;
 
 public:
   std::map<std::string, Type*> children_;
-  std::map<std::string, Value*> values_; // valid for all types except variable and container
 
 
-  Type(std::string name, std::string alias, std::string color, e_entity_types kind, Type* father);
+  Type(std::string name, std::string alias, std::string color, Type* father);
   ~Type();
 
   std::string getName() { return name_; }
   const char* getCname() { return name_.c_str(); }
   ~Type();
 
   std::string getName() { return name_; }
   const char* getCname() { return name_.c_str(); }
-  const char* getId() { return id_.c_str(); }
-  e_entity_types getKind() { return kind_; }
+  long long int getId() { return id_; }
   bool isColored() { return not color_.empty(); }
 
   Type* byName(std::string name);
 
   bool isColored() { return not color_.empty(); }
 
   Type* byName(std::string name);
 
-  Type* getOrCreateContainerType(std::string name);
-  Type* getOrCreateEventType(std::string name);
-  Type* getOrCreateLinkType(std::string name, Type* source, Type* dest);
-  Type* getOrCreateStateType(std::string name);
-  Type* getOrCreateVariableType(std::string name, std::string color);
+  ContainerType* getOrCreateContainerType(std::string name);
+  EventType* getOrCreateEventType(std::string name);
+  LinkType* getOrCreateLinkType(std::string name, Type* source, Type* dest);
+  StateType* getOrCreateStateType(std::string name);
+  VariableType* getOrCreateVariableType(std::string name, std::string color);
+
+  void logDefinition(e_event_type event_type);
+  void logDefinition(Type* source, Type* dest);
+
+  static ContainerType* createRootType();
+  static ContainerType* getRootType();
+};
 
 
+class ContainerType : public Type {
+public:
+  ContainerType(std::string name, Type* father);
+};
+
+class VariableType : public Type {
+public:
+  VariableType(std::string name, std::string color, Type* father);
+};
+
+class ValueType : public Type {
+public:
+  std::map<std::string, Value*> values_;
+  ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){};
+  ValueType(std::string name, Type* father) : Type(name, name, "", father){};
+  ~ValueType();
   void addEntityValue(std::string name, std::string color);
   void addEntityValue(std::string name);
   Value* getEntityValue(std::string name);
   void addEntityValue(std::string name, std::string color);
   void addEntityValue(std::string name);
   Value* getEntityValue(std::string name);
+};
 
 
-  void logContainerTypeDefinition();
-  void logVariableTypeDefinition();
-  void logStateTypeDefinition();
-  void logLinkTypeDefinition(simgrid::instr::Type* source, simgrid::instr::Type* dest);
-  void logDefineEventType();
+class LinkType : public ValueType {
+public:
+  LinkType(std::string name, std::string alias, Type* father);
+};
+
+class EventType : public ValueType {
+public:
+  EventType(std::string name, Type* father);
+};
 
 
-  static Type* createRootType();
-  static Type* getRootType();
+class StateType : public ValueType {
+public:
+  StateType(std::string name, Type* father);
 };
 
 class Value {
 };
 
 class Value {
index 2d0d43d..bdda78a 100644 (file)
@@ -75,8 +75,9 @@ void TRACE_msg_process_suspend(msg_process_t process)
 {
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process));
 {
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process));
-    simgrid::instr::Type* state   = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = state->getEntityValue("suspend");
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(process_container->type_->byName("MSG_PROCESS_STATE"));
+    simgrid::instr::Value* val = state->getEntityValue("suspend");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
 }
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
 }
@@ -94,7 +95,8 @@ void TRACE_msg_process_sleep_in(msg_process_t process)
 {
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process));
 {
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process));
-    simgrid::instr::Type* state   = process_container->type_->byName("MSG_PROCESS_STATE");
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(process_container->type_->byName("MSG_PROCESS_STATE"));
     simgrid::instr::Value* val    = state->getEntityValue("sleep");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
     simgrid::instr::Value* val    = state->getEntityValue("sleep");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
index 39f0254..2b2b425 100644 (file)
@@ -50,8 +50,9 @@ void TRACE_msg_task_execute_start(msg_task_t task)
 
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self()));
 
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self()));
-    simgrid::instr::Type* state   = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = state->getEntityValue("task_execute");
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(process_container->type_->byName("MSG_PROCESS_STATE"));
+    simgrid::instr::Value* val = state->getEntityValue("task_execute");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
 }
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
 }
@@ -84,7 +85,8 @@ void TRACE_msg_task_get_start()
 
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self()));
 
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self()));
-    simgrid::instr::Type* state   = process_container->type_->byName("MSG_PROCESS_STATE");
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(process_container->type_->byName("MSG_PROCESS_STATE"));
     simgrid::instr::Value* val    = state->getEntityValue("receive");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
     simgrid::instr::Value* val    = state->getEntityValue("receive");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
   }
@@ -113,12 +115,14 @@ int TRACE_msg_task_put_start(msg_task_t task)
 
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self()));
 
   if (TRACE_msg_process_is_enabled()){
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self()));
-    simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = type->getEntityValue("send");
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(process_container->type_->byName("MSG_PROCESS_STATE"));
+    simgrid::instr::Value* val = state->getEntityValue("send");
+    new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, state, val);
 
     std::string key = std::string("p") + std::to_string(task->counter);
 
     std::string key = std::string("p") + std::to_string(task->counter);
-    type = simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_TASK_LINK");
+    simgrid::instr::LinkType* type =
+        static_cast<simgrid::instr::LinkType*>(simgrid::instr::Type::getRootType()->byName("MSG_PROCESS_TASK_LINK"));
     new simgrid::instr::StartLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type,
                                        process_container, "SR", key);
   }
     new simgrid::instr::StartLinkEvent(MSG_get_clock(), simgrid::instr::Container::getRootContainer(), type,
                                        process_container, "SR", key);
   }
index a18f43c..bbbfb1a 100644 (file)
@@ -186,7 +186,8 @@ void MSG_vm_start(msg_vm_t vm)
   vm->start();
   if (TRACE_msg_vm_is_enabled()) {
     container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
   vm->start();
   if (TRACE_msg_vm_is_enabled()) {
     container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
-    simgrid::instr::Type* state = vm_container->type_->byName("MSG_VM_STATE");
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(vm_container->type_->byName("MSG_VM_STATE"));
     state->addEntityValue("start", "0 0 1"); // start is blue
     new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, state, state->getEntityValue("start"));
   }
     state->addEntityValue("start", "0 0 1"); // start is blue
     new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, state, state->getEntityValue("start"));
   }
@@ -769,7 +770,8 @@ void MSG_vm_suspend(msg_vm_t vm)
 
   if (TRACE_msg_vm_is_enabled()) {
     container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
 
   if (TRACE_msg_vm_is_enabled()) {
     container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
-    simgrid::instr::Type* state = vm_container->type_->byName("MSG_VM_STATE");
+    simgrid::instr::StateType* state =
+        static_cast<simgrid::instr::StateType*>(vm_container->type_->byName("MSG_VM_STATE"));
     state->addEntityValue("suspend", "1 0 0"); // suspend is red
     new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, state, state->getEntityValue("suspend"));
   }
     state->addEntityValue("suspend", "1 0 0"); // suspend is red
     new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, state, state->getEntityValue("suspend"));
   }
index 31ca8a9..3447878 100644 (file)
@@ -16,7 +16,8 @@
 
 #define TRACE_AUTO_COLL(cat)                                                                                           \
   if (TRACE_is_enabled()) {                                                                                            \
 
 #define TRACE_AUTO_COLL(cat)                                                                                           \
   if (TRACE_is_enabled()) {                                                                                            \
-    simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->getOrCreateEventType(#cat);                      \
+    simgrid::instr::EventType* type =                                                                                  \
+        static_cast<simgrid::instr::EventType*>(simgrid::instr::Type::getRootType()->getOrCreateEventType(#cat));      \
                                                                                                                        \
     char cont_name[25];                                                                                                \
     snprintf(cont_name, 25, "rank-%d", smpi_process()->index());                                                       \
                                                                                                                        \
     char cont_name[25];                                                                                                \
     snprintf(cont_name, 25, "rank-%d", smpi_process()->index());                                                       \
index 648be99..5985693 100644 (file)
@@ -198,10 +198,10 @@ void TRACE_smpi_collective_in(int rank, const char *operation, instr_extra_data
   }
 
   container_t container      = simgrid::instr::Container::byName(smpi_container(rank));
   }
 
   container_t container      = simgrid::instr::Container::byName(smpi_container(rank));
-  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
   const char *color = instr_find_color (operation);
   const char *color = instr_find_color (operation);
-  type->addEntityValue(operation, color);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, type->getEntityValue(operation),
+  state->addEntityValue(operation, color);
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue(operation),
                                      static_cast<void*>(extra));
 }
 
                                      static_cast<void*>(extra));
 }
 
@@ -223,9 +223,9 @@ void TRACE_smpi_computing_init(int rank)
    return;
 
  container_t container      = simgrid::instr::Container::byName(smpi_container(rank));
    return;
 
  container_t container      = simgrid::instr::Container::byName(smpi_container(rank));
- simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
type->addEntityValue("computing", instr_find_color("computing"));
- new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, type->getEntityValue("computing"));
+ simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
state->addEntityValue("computing", instr_find_color("computing"));
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("computing"));
 }
 
 void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
 }
 
 void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
@@ -237,9 +237,9 @@ void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
   }
 
   container_t container      = simgrid::instr::Container::byName(smpi_container(rank));
   }
 
   container_t container      = simgrid::instr::Container::byName(smpi_container(rank));
-  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
-  type->addEntityValue("computing");
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, type->getEntityValue("computing"),
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
+  state->addEntityValue("computing");
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("computing"),
                                      static_cast<void*>(extra));
 }
 
                                      static_cast<void*>(extra));
 }
 
@@ -260,7 +260,7 @@ void TRACE_smpi_sleeping_init(int rank)
     return;
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
     return;
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
-  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
   state->addEntityValue("sleeping", instr_find_color("sleeping"));
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("sleeping"));
 }
   state->addEntityValue("sleeping", instr_find_color("sleeping"));
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("sleeping"));
 }
@@ -274,7 +274,7 @@ void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
   }
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
   }
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
-  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
   state->addEntityValue("sleeping");
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("sleeping"),
                                      static_cast<void*>(extra));
   state->addEntityValue("sleeping");
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("sleeping"),
                                      static_cast<void*>(extra));
@@ -299,7 +299,7 @@ void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
   }
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
   }
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
-  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
   state->addEntityValue("test");
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("test"),
                                      static_cast<void*>(extra));
   state->addEntityValue("test");
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("test"),
                                      static_cast<void*>(extra));
@@ -323,7 +323,7 @@ void TRACE_smpi_ptp_in(int rank, const char *operation, instr_extra_data extra)
   }
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
   }
 
   container_t container       = simgrid::instr::Container::byName(smpi_container(rank));
-  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  simgrid::instr::StateType* state = static_cast<simgrid::instr::StateType*>(container->type_->byName("MPI_STATE"));
   state->addEntityValue(operation, instr_find_color(operation));
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue(operation),
                                      static_cast<void*>(extra));
   state->addEntityValue(operation, instr_find_color(operation));
   new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue(operation),
                                      static_cast<void*>(extra));
index 6d6e819..32a7294 100644 (file)
@@ -96,8 +96,9 @@ static void linkContainers(container_t src, container_t dst, std::set<std::strin
   filter->insert(aux2);
 
   //declare type
   filter->insert(aux2);
 
   //declare type
-  std::string link_typename = father->type_->getName() + "-" + src->type_->getName() + src->type_->getId() + "-" +
-                              dst->type_->getName() + dst->type_->getId();
+  std::string link_typename = father->type_->getName() + "-" + src->type_->getName() +
+                              std::to_string(src->type_->getId()) + "-" + dst->type_->getName() +
+                              std::to_string(dst->type_->getId());
   simgrid::instr::Type* link_type = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_);
 
   //register EDGE types for triva configuration
   simgrid::instr::Type* link_type = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_);
 
   //register EDGE types for triva configuration
@@ -218,8 +219,8 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     container->type_->getOrCreateContainerType("MPI")->getOrCreateStateType("MPI_STATE");
 
   if (TRACE_msg_process_is_enabled()) {
     container->type_->getOrCreateContainerType("MPI")->getOrCreateStateType("MPI_STATE");
 
   if (TRACE_msg_process_is_enabled()) {
-    simgrid::instr::Type* msg_process = container->type_->getOrCreateContainerType("MSG_PROCESS");
-    simgrid::instr::Type* state       = msg_process->getOrCreateStateType("MSG_PROCESS_STATE");
+    simgrid::instr::ContainerType* msg_process = container->type_->getOrCreateContainerType("MSG_PROCESS");
+    simgrid::instr::StateType* state           = msg_process->getOrCreateStateType("MSG_PROCESS_STATE");
     state->addEntityValue("suspend", "1 0 1");
     state->addEntityValue("sleep", "1 1 0");
     state->addEntityValue("receive", "1 0 0");
     state->addEntityValue("suspend", "1 0 1");
     state->addEntityValue("sleep", "1 1 0");
     state->addEntityValue("receive", "1 0 0");
@@ -230,8 +231,8 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
   }
 
   if (TRACE_msg_vm_is_enabled()) {
   }
 
   if (TRACE_msg_vm_is_enabled()) {
-    simgrid::instr::Type* msg_vm = container->type_->getOrCreateContainerType("MSG_VM");
-    simgrid::instr::Type* state  = msg_vm->getOrCreateStateType("MSG_VM_STATE");
+    simgrid::instr::ContainerType* msg_vm = container->type_->getOrCreateContainerType("MSG_VM");
+    simgrid::instr::StateType* state      = msg_vm->getOrCreateStateType("MSG_VM_STATE");
     state->addEntityValue("suspend", "1 0 1");
     state->addEntityValue("sleep", "1 1 0");
     state->addEntityValue("receive", "1 0 0");
     state->addEntityValue("suspend", "1 0 1");
     state->addEntityValue("sleep", "1 1 0");
     state->addEntityValue("receive", "1 0 0");
@@ -329,7 +330,7 @@ static void recursiveNewValueForUserStateType(std::string type_name, const char*
                                               simgrid::instr::Type* root)
 {
   if (root->getName() == type_name)
                                               simgrid::instr::Type* root)
 {
   if (root->getName() == type_name)
-    root->addEntityValue(val, color);
+    static_cast<simgrid::instr::StateType*>(root)->addEntityValue(val, color);
 
   for (auto elm : root->children_)
     recursiveNewValueForUserStateType(type_name, val, color, elm.second);
 
   for (auto elm : root->children_)
     recursiveNewValueForUserStateType(type_name, val, color, elm.second);