Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix conflict
authorTakishipp <toufik.boubehziz@gmail.com>
Fri, 21 Jul 2017 10:34:32 +0000 (12:34 +0200)
committerTakishipp <toufik.boubehziz@gmail.com>
Fri, 21 Jul 2017 10:34:32 +0000 (12:34 +0200)
src/instr/instr_interface.cpp
src/instr/instr_paje_values.cpp
src/instr/instr_private.h
src/surf/instr_routing.cpp

index 76a78e6..dfe6eb1 100644 (file)
@@ -196,7 +196,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar
     mark_color = white;
 
   XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
-  pj_value.PJ_value_new (mark_value, mark_color, type);
+  s_val rett(mark_value, mark_color, type);
 }
 
 /** \ingroup TRACE_mark
index 587a076..9e60ab1 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)");
 
-val_t paje_value :: PJ_value_new (const char *name, const char *color, type_t father)
+val_t s_val::PJ_value_update (const char *name, const char *color, type_t father)
 {
+  this->ret = xbt_new0(s_val, 1);
+  this->ret->name = xbt_strdup (name);
+  this->ret->father = father;
+  this->ret->color = xbt_strdup (color);
+
+  char str_id[INSTR_DEFAULT_STR_SIZE];
+  snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
+  this->ret->id = xbt_strdup (str_id);
+
+  xbt_dict_set (father->values, name, ret, nullptr);
+  XBT_DEBUG("new value %s, child of %s", this->ret->name, this->ret->father->name);
+  LogEntityValue(this->ret);
+  return this->ret;
+}
+
+s_val::s_val(const char *name, const char *color, type_t father){
   if (name == nullptr || father == nullptr){
     THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)");
   }
-
-  val_t ret = xbt_new0(s_val_t, 1);
-  ret->name = xbt_strdup (name);
-  ret->father = father;
-  ret->color = xbt_strdup (color);
+  this->ret = xbt_new0(s_val, 1);
+  this->ret->name = xbt_strdup (name);
+  this->ret->father = father;
+  this->ret->color = xbt_strdup (color);
 
   char str_id[INSTR_DEFAULT_STR_SIZE];
   snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
-  ret->id = xbt_strdup (str_id);
+  this->ret->id = xbt_strdup (str_id);
 
   xbt_dict_set (father->values, name, ret, nullptr);
   XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name);
-  LogEntityValue(ret);
-  return ret;
-}
+  LogEntityValue(this->ret);
+};
 
 val_t paje_value :: PJ_value_get_or_new (const char *name, const char *color, type_t father)
 { paje_value pj_value;
@@ -38,7 +52,8 @@ val_t paje_value :: PJ_value_get_or_new (const char *name, const char *color, ty
     ret = pj_value.PJ_value_get(name, father);
   }
   catch(xbt_ex& e) {
-    ret = pj_value.PJ_value_new(name, color, father);
+    s_val rett(name, color, father);
+    ret = rett.ret;
   }
   return ret;
 }
index 3788926..7be771e 100644 (file)
@@ -81,8 +81,11 @@ class s_val {
   char *name;
   char *color;
   type_t father;
+  val_t ret;
+  s_val(const char *name, const char *color, type_t father);
+  val_t PJ_value_update (const char *name, const char *color, type_t father);
 };
-typedef s_val s_val_t;
+
 
 //--------------------------------------------------
 typedef enum {
@@ -359,6 +362,10 @@ XBT_PRIVATE XBT_PRIVATE void PJ_type_free (type_t type);
 /* instr_config.c */
 XBT_PRIVATE void recursiveDestroyType (type_t type);
 
+/* instr_paje_values.c */
+XBT_PUBLIC(val_t)  PJ_value_get_or_new (const char *name, const char *color, type_t father);
+XBT_PUBLIC(val_t)  PJ_value_get (const char *name, const type_t father);
+
 XBT_PRIVATE void TRACE_TI_start();
 XBT_PRIVATE void TRACE_TI_end();
 
index 039ed4c..7044975 100644 (file)
@@ -267,11 +267,11 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     if (msg_process == nullptr){
       msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
       type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
-      pj_value.PJ_value_new ("suspend", "1 0 1", state);
-      pj_value.PJ_value_new ("sleep", "1 1 0", state);
-      pj_value.PJ_value_new ("receive", "1 0 0", state);
-      pj_value.PJ_value_new ("send", "0 0 1", state);
-      pj_value.PJ_value_new ("task_execute", "0 1 1", state);
+      s_val PJ_value("suspend", "1 0 1", state);
+      PJ_value.PJ_value_update("sleep", "1 1 0", state);
+      PJ_value.PJ_value_update("receive", "1 0 0", state);
+      PJ_value.PJ_value_update("send", "0 0 1", state);
+      PJ_value.PJ_value_update("task_execute", "0 1 1", state);
       PJ_type_link_new ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process);
       PJ_type_link_new ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process);
     }
@@ -282,11 +282,11 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     if (msg_vm == nullptr){
       msg_vm = PJ_type_container_new("MSG_VM", container->type);
       type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
-      pj_value.PJ_value_new ("suspend", "1 0 1", state);
-      pj_value.PJ_value_new ("sleep", "1 1 0", state);
-      pj_value.PJ_value_new ("receive", "1 0 0", state);
-      pj_value.PJ_value_new ("send", "0 0 1", state);
-      pj_value.PJ_value_new ("task_execute", "0 1 1", state);
+      s_val PJ_value("suspend", "1 0 1", state);
+      PJ_value.PJ_value_update ("sleep", "1 1 0", state);
+      PJ_value.PJ_value_update ("receive", "1 0 0", state);
+      PJ_value.PJ_value_update ("send", "0 0 1", state);
+      PJ_value.PJ_value_update ("task_execute", "0 1 1", state);
       PJ_type_link_new ("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm);
       PJ_type_link_new ("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm);
     }
@@ -403,7 +403,7 @@ void instr_new_user_state_type (const char *father_type, const char *new_typenam
 static void recursiveNewValueForUserStateType (const char *type_name, const char *value, const char *color, type_t root)
 { paje_value pj_value;
   if (not strcmp(root->name, type_name)) {
-    pj_value.PJ_value_new (value, color, root);
+    s_val PJ_value (value, color, root);
   }
   xbt_dict_cursor_t cursor = nullptr;
   type_t child_type;