Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Value is always attached to Type
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 18 Oct 2017 09:30:36 +0000 (11:30 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 18 Oct 2017 09:30:36 +0000 (11:30 +0200)
replace Value::byNameOrCreate and Value::byName by
Type::addEntityValue and Type::getEntityValue

src/instr/instr_interface.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_values.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 6263fcd..65d54c7 100644 (file)
@@ -187,7 +187,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);
-  simgrid::instr::Value::byNameOrCreate(mark_value, mark_color, type);
+  type->addEntityValue(mark_value, mark_color);
 }
 
 /** \ingroup TRACE_mark
 }
 
 /** \ingroup TRACE_mark
@@ -239,8 +239,7 @@ void TRACE_mark(const char *mark_type, const char *mark_value)
   }
 
   XBT_DEBUG("MARK %s %s", mark_type, mark_value);
   }
 
   XBT_DEBUG("MARK %s %s", mark_type, mark_value);
-  new simgrid::instr::NewEvent(MSG_get_clock(), PJ_container_get_root(), type,
-                               simgrid::instr::Value::byName(mark_value, type));
+  new simgrid::instr::NewEvent(MSG_get_clock(), PJ_container_get_root(), type, type->getEntityValue(mark_value));
 }
 
 /** \ingroup TRACE_mark
 }
 
 /** \ingroup TRACE_mark
@@ -937,12 +936,12 @@ void TRACE_host_state_declare_value (const char *state, const char *value, const
  *
  *  \see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
  *
  *  \see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
-void TRACE_host_set_state(const char* host, const char* state, const char* value_str)
+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* type = container->type_->byName(state);
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate(value_str, "", type);
-  new simgrid::instr::SetStateEvent(MSG_get_clock(), container, type, val);
+  container_t container       = simgrid::instr::Container::byName(host);
+  simgrid::instr::Type* state = container->type_->byName(state_name);
+  state->addEntityValue(value_name);
+  new simgrid::instr::SetStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
 }
 
 /** \ingroup TRACE_user_variables
 }
 
 /** \ingroup TRACE_user_variables
@@ -956,12 +955,12 @@ void TRACE_host_set_state(const char* host, const char* state, const char* value
  *
  *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
  *
  *  \see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state, TRACE_host_reset_state
  */
-void TRACE_host_push_state(const char* host, const char* state, const char* value_str)
+void TRACE_host_push_state(const char* host, const char* state_name, const char* value_name)
 {
   container_t container      = simgrid::instr::Container::byName(host);
 {
   container_t container      = simgrid::instr::Container::byName(host);
-  simgrid::instr::Type* type = container->type_->byName(state);
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate(value_str, "", type);
-  new simgrid::instr::PushStateEvent(MSG_get_clock(), container, type, val);
+  simgrid::instr::Type* state = container->type_->byName(state_name);
+  state->addEntityValue(value_name);
+  new simgrid::instr::PushStateEvent(MSG_get_clock(), container, state, state->getEntityValue(value_name));
 }
 
 /** \ingroup TRACE_user_variables
 }
 
 /** \ingroup TRACE_user_variables
index 87c7f20..a6e5a95 100644 (file)
@@ -53,6 +53,37 @@ Type* Type::byName(std::string name)
   return ret;
 }
 
   return ret;
 }
 
+void Type::addEntityValue(std::string name)
+{
+  addEntityValue(name, "");
+}
+
+void Type::addEntityValue(std::string name, std::string color)
+{
+  if (name.empty()) {
+    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});
+    XBT_DEBUG("new value %s, child of %s", name_.c_str(), getCname());
+    new_val->print();
+  }
+}
+
+Value* Type::getEntityValue(std::string name)
+{
+  auto ret = values_.find(name);
+  if (ret == values_.end()) {
+    THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name.c_str(), getCname());
+  }
+  return ret->second;
+}
+
 Type* Type::createRootType()
 {
   simgrid::instr::Type* ret = new simgrid::instr::Type("0", "0", "", TYPE_CONTAINER, nullptr);
 Type* Type::createRootType()
 {
   simgrid::instr::Type* ret = new simgrid::instr::Type("0", "0", "", TYPE_CONTAINER, nullptr);
index 380f1c6..b49b3fe 100644 (file)
@@ -14,14 +14,7 @@ namespace instr {
 
 Value::Value(std::string name, std::string color, Type* father) : name_(name), color_(color), father_(father)
 {
 
 Value::Value(std::string name, std::string color, Type* father) : name_(name), color_(color), father_(father)
 {
-  if (name.empty() || father == nullptr) {
-    THROWF(tracing_error, 0, "can't create a value with no name (or a nullptr father)");
-  }
   this->id_    = std::to_string(instr_new_paje_id());
   this->id_    = std::to_string(instr_new_paje_id());
-
-  father->values_.insert({name, this});
-  XBT_DEBUG("new value %s, child of %s", name_.c_str(), father_->getCname());
-  print();
 };
 
 Value::~Value()
 };
 
 Value::~Value()
@@ -29,30 +22,5 @@ Value::~Value()
   XBT_DEBUG("free value %s, child of %s", getCname(), father_->getCname());
 }
 
   XBT_DEBUG("free value %s, child of %s", getCname(), father_->getCname());
 }
 
-Value* Value::byNameOrCreate(std::string name, std::string color, Type* father)
-{
-  Value* ret = nullptr;
-  try {
-    ret = Value::byName(name, father);
-  } catch (xbt_ex& e) {
-    ret = new Value(name, color, father);
-  }
-  return ret;
-}
-
-Value* Value::byName(std::string name, Type* father)
-{
-  if (name.empty() || father == nullptr) {
-    THROWF(tracing_error, 0, "can't get a value with no name (or a nullptr father)");
-  }
-
-  if (father->getKind() == TYPE_VARIABLE)
-    THROWF(tracing_error, 0, "variables can't have different values (%s)", father->getCname());
-  auto ret = father->values_.find(name);
-  if (ret == father->values_.end()) {
-    THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name.c_str(), father->getCname());
-  }
-  return ret->second;
-}
 }
 }
 }
 }
index f7d6bed..1a1c9c7 100644 (file)
@@ -85,6 +85,10 @@ public:
   Type* getOrCreateStateType(std::string name);
   Type* getOrCreateVariableType(std::string name, std::string color);
 
   Type* getOrCreateStateType(std::string name);
   Type* getOrCreateVariableType(std::string name, std::string color);
 
+  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 logContainerTypeDefinition();
   void logVariableTypeDefinition();
   void logStateTypeDefinition();
@@ -102,12 +106,9 @@ class Value {
   std::string color_;
   Type* father_;
 
   std::string color_;
   Type* father_;
 
-  explicit Value(std::string name, std::string color, Type* father);
-
 public:
 public:
+  explicit Value(std::string name, std::string color, Type* father);
   ~Value();
   ~Value();
-  static Value* byNameOrCreate(std::string name, std::string color, Type* father);
-  static Value* byName(std::string name, Type* father);
   const char* getCname() { return name_.c_str(); }
   const char* getId() { return id_.c_str(); }
   bool isColored() { return not color_.empty(); }
   const char* getCname() { return name_.c_str(); }
   const char* getId() { return id_.c_str(); }
   bool isColored() { return not color_.empty(); }
index d82c9ca..fbffce2 100644 (file)
@@ -95,9 +95,9 @@ void TRACE_msg_process_suspend(msg_process_t process)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process, str, len));
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process, str, len));
-    simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = simgrid::instr::Value::byName("suspend", type);
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
+    simgrid::instr::Type* state   = 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);
   }
 }
 
   }
 }
 
@@ -120,9 +120,9 @@ void TRACE_msg_process_sleep_in(msg_process_t process)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process, str, len));
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(process, str, len));
-    simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = simgrid::instr::Value::byName("sleep", type);
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
+    simgrid::instr::Type* state   = 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);
   }
 }
 
   }
 }
 
index 4eb14d3..633e041 100644 (file)
@@ -53,9 +53,9 @@ void TRACE_msg_task_execute_start(msg_task_t task)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self(), str, len));
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self(), str, len));
-    simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = simgrid::instr::Value::byName("task_execute", type);
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
+    simgrid::instr::Type* state   = 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);
   }
 }
 
   }
 }
 
@@ -93,9 +93,9 @@ void TRACE_msg_task_get_start()
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self(), str, len));
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self(), str, len));
-    simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = simgrid::instr::Value::byName("receive", type);
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
+    simgrid::instr::Type* state   = 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);
   }
 }
 
   }
 }
 
@@ -129,7 +129,7 @@ int TRACE_msg_task_put_start(msg_task_t task)
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self(), str, len));
     simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
 
     container_t process_container = simgrid::instr::Container::byName(instr_process_id(MSG_process_self(), str, len));
     simgrid::instr::Type* type    = process_container->type_->byName("MSG_PROCESS_STATE");
-    simgrid::instr::Value* val    = simgrid::instr::Value::byName("send", type);
+    simgrid::instr::Value* val    = type->getEntityValue("send");
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
 
     char key[INSTR_DEFAULT_STR_SIZE];
     new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
 
     char key[INSTR_DEFAULT_STR_SIZE];
index 126d3d8..032b24c 100644 (file)
@@ -185,10 +185,10 @@ void MSG_vm_start(msg_vm_t vm)
 {
   vm->start();
   if (TRACE_msg_vm_is_enabled()) {
 {
   vm->start();
   if (TRACE_msg_vm_is_enabled()) {
-    container_t vm_container   = simgrid::instr::Container::byName(vm->getName());
-    simgrid::instr::Type* type = vm_container->type_->byName("MSG_VM_STATE");
-    simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("start", "0 0 1", type); // start is blue
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val);
+    container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
+    simgrid::instr::Type* state = 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"));
   }
 }
 
   }
 }
 
@@ -768,10 +768,10 @@ void MSG_vm_suspend(msg_vm_t vm)
   XBT_DEBUG("vm_suspend done");
 
   if (TRACE_msg_vm_is_enabled()) {
   XBT_DEBUG("vm_suspend done");
 
   if (TRACE_msg_vm_is_enabled()) {
-    container_t vm_container   = simgrid::instr::Container::byName(vm->getName());
-    simgrid::instr::Type* type = vm_container->type_->byName("MSG_VM_STATE");
-    simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("suspend", "1 0 0", type); // suspend is red
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val);
+    container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
+    simgrid::instr::Type* state = 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"));
   }
 }
 
   }
 }
 
index 12ef8f3..31ca8a9 100644 (file)
@@ -20,9 +20,9 @@
                                                                                                                        \
     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());                                                       \
-    simgrid::instr::Value* val =                                                                                       \
-        simgrid::instr::Value::byNameOrCreate(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type);       \
-    new simgrid::instr::NewEvent(SIMIX_get_clock(), simgrid::instr::Container::byName(cont_name), type, val);          \
+    type->addEntityValue(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0");                                  \
+    new simgrid::instr::NewEvent(SIMIX_get_clock(), simgrid::instr::Container::byName(cont_name), type,                \
+                                 type->getEntityValue(Colls::mpi_coll_##cat##_description[i].name));                   \
   }
 
 #define AUTOMATIC_COLL_BENCH(cat, ret, args, args2)                                                                    \
   }
 
 #define AUTOMATIC_COLL_BENCH(cat, ret, args, args2)                                                                    \
index 2d07348..58ee601 100644 (file)
@@ -237,8 +237,9 @@ void TRACE_smpi_collective_in(int rank, const char *operation, instr_extra_data
   container_t container      = simgrid::instr::Container::byName(str);
   simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
   const char *color = instr_find_color (operation);
   container_t container      = simgrid::instr::Container::byName(str);
   simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
   const char *color = instr_find_color (operation);
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate(operation, color, type);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+  type->addEntityValue(operation, color);
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, type->getEntityValue(operation),
+                                     static_cast<void*>(extra));
 }
 
 void TRACE_smpi_collective_out(int rank, const char *operation)
 }
 
 void TRACE_smpi_collective_out(int rank, const char *operation)
@@ -264,9 +265,8 @@ void TRACE_smpi_computing_init(int rank)
  smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
  container_t container      = simgrid::instr::Container::byName(str);
  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
  smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
  container_t container      = simgrid::instr::Container::byName(str);
  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
- const char* color     = instr_find_color("computing");
- new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type,
-                                    simgrid::instr::Value::byNameOrCreate("computing", color, type));
+ type->addEntityValue("computing", instr_find_color("computing"));
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, type->getEntityValue("computing"));
 }
 
 void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
 }
 
 void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
@@ -281,8 +281,9 @@ void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
   simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
   simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("computing", "", type);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+  type->addEntityValue("computing");
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, type->getEntityValue("computing"),
+                                     static_cast<void*>(extra));
 }
 
 void TRACE_smpi_computing_out(int rank)
 }
 
 void TRACE_smpi_computing_out(int rank)
@@ -305,10 +306,9 @@ void TRACE_smpi_sleeping_init(int rank)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
-  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
-  const char *color = instr_find_color ("sleeping");
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("sleeping", color, type);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val);
+  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  state->addEntityValue("sleeping", instr_find_color("sleeping"));
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("sleeping"));
 }
 
 void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
 }
 
 void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
@@ -322,9 +322,10 @@ void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
-  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("sleeping", "", type);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  state->addEntityValue("sleeping");
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("sleeping"),
+                                     static_cast<void*>(extra));
 }
 
 void TRACE_smpi_sleeping_out(int rank)
 }
 
 void TRACE_smpi_sleeping_out(int rank)
@@ -349,9 +350,10 @@ void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
-  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("test", "", type);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+  simgrid::instr::Type* state = container->type_->byName("MPI_STATE");
+  state->addEntityValue("test");
+  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, state, state->getEntityValue("test"),
+                                     static_cast<void*>(extra));
 }
 
 void TRACE_smpi_testing_out(int rank)
 }
 
 void TRACE_smpi_testing_out(int rank)
@@ -375,10 +377,10 @@ void TRACE_smpi_ptp_in(int rank, const char *operation, instr_extra_data extra)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container      = simgrid::instr::Container::byName(str);
-  simgrid::instr::Type* type = container->type_->byName("MPI_STATE");
-  const char *color = instr_find_color (operation);
-  simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate(operation, color, type);
-  new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+  simgrid::instr::Type* state = 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));
 }
 
 void TRACE_smpi_ptp_out(int rank, int dst, const char *operation)
 }
 
 void TRACE_smpi_ptp_out(int rank, int dst, const char *operation)
index 6447bce..ccb7013 100644 (file)
@@ -223,11 +223,11 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
   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");
   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::Value::byNameOrCreate("suspend", "1 0 1", state);
-    simgrid::instr::Value::byNameOrCreate("sleep", "1 1 0", state);
-    simgrid::instr::Value::byNameOrCreate("receive", "1 0 0", state);
-    simgrid::instr::Value::byNameOrCreate("send", "0 0 1", state);
-    simgrid::instr::Value::byNameOrCreate("task_execute", "0 1 1", state);
+    state->addEntityValue("suspend", "1 0 1");
+    state->addEntityValue("sleep", "1 1 0");
+    state->addEntityValue("receive", "1 0 0");
+    state->addEntityValue("send", "0 0 1");
+    state->addEntityValue("task_execute", "0 1 1");
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_PROCESS_LINK", msg_process, msg_process);
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_PROCESS_TASK_LINK", msg_process, msg_process);
   }
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_PROCESS_LINK", msg_process, msg_process);
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_PROCESS_TASK_LINK", msg_process, msg_process);
   }
@@ -235,11 +235,11 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
   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");
   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::Value::byNameOrCreate("suspend", "1 0 1", state);
-    simgrid::instr::Value::byNameOrCreate("sleep", "1 1 0", state);
-    simgrid::instr::Value::byNameOrCreate("receive", "1 0 0", state);
-    simgrid::instr::Value::byNameOrCreate("send", "0 0 1", state);
-    simgrid::instr::Value::byNameOrCreate("task_execute", "0 1 1", state);
+    state->addEntityValue("suspend", "1 0 1");
+    state->addEntityValue("sleep", "1 1 0");
+    state->addEntityValue("receive", "1 0 0");
+    state->addEntityValue("send", "0 0 1");
+    state->addEntityValue("task_execute", "0 1 1");
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_VM_LINK", msg_vm, msg_vm);
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_VM_PROCESS_LINK", msg_vm, msg_vm);
   }
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_VM_LINK", msg_vm, msg_vm);
     simgrid::instr::Type::getRootType()->getOrCreateLinkType("MSG_VM_PROCESS_LINK", msg_vm, msg_vm);
   }
@@ -333,7 +333,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)
-    simgrid::instr::Value::byNameOrCreate(val, color, root);
+    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);