Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Offer the possibility to change smpi bandwidth and latency factor into tag config...
[simgrid.git] / src / instr / instr_msg_task.c
index 46d28b0..b75039e 100644 (file)
@@ -15,16 +15,16 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg, instr, "MSG");
  */
 void TRACE_msg_set_task_category(m_task_t task, const char *category)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_categorized())
     return;
 
-  xbt_assert3(task->category == NULL, "Task %p(%s) already has a category (%s).",
+  xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).",
       task, task->name, task->category);
   if (TRACE_msg_task_is_enabled()){
-    xbt_assert2(task->name != NULL,
+    xbt_assert(task->name != NULL,
         "Task %p(%s) must have a unique name in order to be traced, if --cfg=tracing/msg/task:1 is used.",
         task, task->name);
-    xbt_assert3(getContainer(task->name)==NULL,
+    xbt_assert(getContainer(task->name)==NULL,
         "Task %p(%s). Tracing already knows a task with name %s."
         "The name of each task must be unique, if --cfg=tracing/msg/task:1 is used.", task, task->name, task->name);
   }
@@ -38,13 +38,13 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category)
 
   //set task category
   task->category = xbt_strdup (category);
-  DEBUG3("MSG task %p(%s), category %s", task, task->name, task->category);
+  XBT_DEBUG("MSG task %p(%s), category %s", task, task->name, task->category);
 
   if (TRACE_msg_task_is_enabled()){
     m_host_t host = MSG_host_self();
     container_t host_container = getContainer(host->name);
     //check to see if there is a container with the task->name
-    xbt_assert3(getContainer(task->name) == NULL,
+    xbt_assert(getContainer(task->name) == NULL,
         "Task %p(%s). Tracing already knows a task with name %s."
         "The name of each task must be unique, if --cfg=tracing/msg/task:1 is used.", task, task->name, task->name);
     container_t msg = newContainer(task->name, INSTR_MSG_TASK, host_container);
@@ -55,7 +55,8 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category)
     new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
 
     type = getType ("MSG_TASK_STATE", msg->type);
-    new_pajePushState (MSG_get_clock(), msg, type, "created");
+    val_t value = getValueByName ("created", type);
+    new_pajePushState (MSG_get_clock(), msg, type, value);
   }
 }
 
@@ -65,18 +66,19 @@ void TRACE_msg_task_create(m_task_t task)
   static long long counter = 0;
   task->counter = counter++;
   task->category = NULL;
-  DEBUG2("CREATE %p, %lld", task, task->counter);
+  XBT_DEBUG("CREATE %p, %lld", task, task->counter);
 }
 
 /* MSG_task_execute related functions */
 void TRACE_msg_task_execute_start(m_task_t task)
 {
-  DEBUG3("EXEC,in %p, %lld, %s", task, task->counter, task->category);
+  XBT_DEBUG("EXEC,in %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_msg_task_is_enabled()){
     container_t task_container = getContainer (task->name);
     type_t type = getType ("MSG_TASK_STATE", task_container->type);
-    new_pajePushState (MSG_get_clock(), task_container, type, "MSG_task_execute");
+    val_t value = getValueByName ("MSG_task_execute", type);
+    new_pajePushState (MSG_get_clock(), task_container, type, value);
   }
 
   if (TRACE_msg_process_is_enabled()){
@@ -85,13 +87,14 @@ void TRACE_msg_task_execute_start(m_task_t task)
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
     type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
-    new_pajePushState (MSG_get_clock(), process_container, type, "task_execute");
+    val_t value = getValueByName ("task_execute", type);
+    new_pajePushState (MSG_get_clock(), process_container, type, value);
   }
 }
 
 void TRACE_msg_task_execute_end(m_task_t task)
 {
-  DEBUG3("EXEC,out %p, %lld, %s", task, task->counter, task->category);
+  XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_msg_task_is_enabled()){
     container_t task_container = getContainer (task->name);
@@ -112,7 +115,7 @@ void TRACE_msg_task_execute_end(m_task_t task)
 /* MSG_task_destroy related functions */
 void TRACE_msg_task_destroy(m_task_t task)
 {
-  DEBUG3("DESTROY %p, %lld, %s", task, task->counter, task->category);
+  XBT_DEBUG("DESTROY %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_msg_task_is_enabled()){
     //that's the end, let's destroy it
@@ -128,7 +131,7 @@ void TRACE_msg_task_destroy(m_task_t task)
 /* MSG_task_get related functions */
 void TRACE_msg_task_get_start(void)
 {
-  DEBUG0("GET,in");
+  XBT_DEBUG("GET,in");
 
   if (TRACE_msg_task_is_enabled()){
     //task not received yet, nothing to do
@@ -140,21 +143,17 @@ void TRACE_msg_task_get_start(void)
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
     type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
-    new_pajePushState (MSG_get_clock(), process_container, type, "receive");
+    val_t value = getValueByName ("receive", type);
+    new_pajePushState (MSG_get_clock(), process_container, type, value);
   }
 }
 
 void TRACE_msg_task_get_end(double start_time, m_task_t task)
 {
-  DEBUG3("GET,out %p, %lld, %s", task, task->counter, task->category);
+  XBT_DEBUG("GET,out %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_msg_task_is_enabled()){
 
-    //FIXME
-    //if (TRACE_msg_volume_is_enabled()){
-    //  TRACE_msg_volume_end(task);
-    //}
-
     m_host_t host = MSG_host_self();
     container_t host_container = getContainer(host->name);
     container_t msg = newContainer(task->name, INSTR_MSG_TASK, host_container);
@@ -162,7 +161,8 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task)
     new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
 
     type = getType ("MSG_TASK_STATE", msg->type);
-    new_pajePushState (MSG_get_clock(), msg, type, "created");
+    val_t value = getValueByName ("created", type);
+    new_pajePushState (MSG_get_clock(), msg, type, value);
 
     type = getType ("MSG_TASK_LINK", getRootType());
     char key[INSTR_DEFAULT_STR_SIZE];
@@ -188,7 +188,7 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task)
 /* MSG_task_put related functions */
 int TRACE_msg_task_put_start(m_task_t task)
 {
-  DEBUG3("PUT,in %p, %lld, %s", task, task->counter, task->category);
+  XBT_DEBUG("PUT,in %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_msg_task_is_enabled()){
 
@@ -202,11 +202,6 @@ int TRACE_msg_task_put_start(m_task_t task)
     new_pajeStartLink(MSG_get_clock(), getRootContainer(), type, msg, "SR", key);
 
     destroyContainer (msg);
-
-    //FIXME
-    //if (TRACE_msg_volume_is_enabled()){
-    //  TRACE_msg_volume_start(task);
-    //}
   }
 
   if (TRACE_msg_process_is_enabled()){
@@ -215,7 +210,8 @@ int TRACE_msg_task_put_start(m_task_t task)
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
     type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
-    new_pajePushState (MSG_get_clock(), process_container, type, "send");
+    val_t value = getValueByName ("send", type);
+    new_pajePushState (MSG_get_clock(), process_container, type, value);
 
     char key[INSTR_DEFAULT_STR_SIZE];
     snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
@@ -228,7 +224,7 @@ int TRACE_msg_task_put_start(m_task_t task)
 
 void TRACE_msg_task_put_end(void)
 {
-  DEBUG0("PUT,out");
+  XBT_DEBUG("PUT,out");
 
   if (TRACE_msg_task_is_enabled()){
     //task no longer exists here