Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] debug messages for event buffering and tracing
[simgrid.git] / src / instr / instr_msg_task.c
index 8aabfcf..5155dfb 100644 (file)
@@ -54,12 +54,13 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category)
     msg = newContainer(task->name, INSTR_MSG_TASK, host_container);
     type_t type = getType (task->category);
     if (!type){
-      type = newVariableType(task->category, TYPE_VARIABLE, NULL, msg->type);
+      type = getVariableType(task->category, NULL, msg->type);
     }
-    pajeSetVariable(SIMIX_get_clock(), type->id, msg->id, "1");
+    new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
+
+    type = getType ("MSG_TASK_STATE");
+    new_pajePushState (MSG_get_clock(), msg, type, "created");
 
-    //FIXME
-    //pajePushState(MSG_get_clock(), "task-state", name, "created");
     xbt_dict_set (tasks_created, task->name, xbt_strdup("1"), xbt_free);
   }
 }
@@ -82,8 +83,9 @@ void TRACE_msg_task_execute_start(m_task_t task)
 
   DEBUG3("EXEC,in %p, %lld, %s", task, task->counter, task->category);
 
-  //FIXME
-  //pajePushState(MSG_get_clock(), "task-state", name, "execute");
+  container_t task_container = getContainer (task->name);
+  type_t type = getType ("MSG_TASK_STATE");
+  new_pajePushState (MSG_get_clock(), task_container, type, "MSG_task_execute");
 }
 
 void TRACE_msg_task_execute_end(m_task_t task)
@@ -94,8 +96,9 @@ void TRACE_msg_task_execute_end(m_task_t task)
 
   DEBUG3("EXEC,out %p, %lld, %s", task, task->counter, task->category);
 
-  //FIXME
-  //pajePopState(MSG_get_clock(), "task-state", name);
+  container_t task_container = getContainer (task->name);
+  type_t type = getType ("MSG_TASK_STATE");
+  new_pajePopState (MSG_get_clock(), task_container, type);
 }
 
 /* MSG_task_destroy related functions */
@@ -136,9 +139,6 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task)
 
   DEBUG3("GET,out %p, %lld, %s", task, task->counter, task->category);
 
-  //FIXME
-  //pajePopState(MSG_get_clock(), "task-state", name);
-
   //FIXME
   //if (TRACE_msg_volume_is_enabled()){
   //  TRACE_msg_volume_end(task);
@@ -148,7 +148,15 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task)
   container_t host_container = getContainer(host->name);
   container_t msg = newContainer(task->name, INSTR_MSG_TASK, host_container);
   type_t type = getType (task->category);
-  pajeSetVariable(SIMIX_get_clock(), type->id, msg->id, "1");
+  new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
+
+  type = getType ("MSG_TASK_STATE");
+  new_pajePushState (MSG_get_clock(), msg, type, "created");
+
+  type = getType ("MSG_TASK_LINK");
+  char key[INSTR_DEFAULT_STR_SIZE];
+  snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", task->counter);
+  new_pajeEndLink (MSG_get_clock(), getRootContainer(), type, msg, "SR", key);
 }
 
 /* MSG_task_put related functions */
@@ -160,11 +168,16 @@ int TRACE_msg_task_put_start(m_task_t task)
 
   DEBUG3("PUT,in %p, %lld, %s", task, task->counter, task->category);
 
-  destroyContainer (getContainer(task->name));
+  container_t msg = getContainer (task->name);
+  type_t type = getType ("MSG_TASK_STATE");
+  new_pajePopState (MSG_get_clock(), msg, type);
 
-  //FIXME
-  //pajePopState(MSG_get_clock(), "task-state", name);
-  //pajePushState(MSG_get_clock(), "task-state", name, "communicate");
+  type = getType ("MSG_TASK_LINK");
+  char key[INSTR_DEFAULT_STR_SIZE];
+  snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", task->counter);
+  new_pajeStartLink(MSG_get_clock(), getRootContainer(), type, msg, "SR", key);
+
+  destroyContainer (msg);
 
   //FIXME
   //if (TRACE_msg_volume_is_enabled()){