Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] better way of getting references to types
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 7 Feb 2011 13:36:35 +0000 (13:36 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 7 Feb 2011 13:36:35 +0000 (13:36 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9580 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/instr_msg_process.c
src/instr/instr_msg_task.c
src/instr/instr_paje.c
src/instr/instr_private.h
src/instr/instr_smpi.c

index 34e2dae..8a392dc 100644 (file)
@@ -39,7 +39,7 @@ void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host, m_hos
 
     //start link
     container_t msg = getContainer(instr_process_id(process, str, len));
-    type_t type = getType ("MSG_PROCESS_LINK");
+    type_t type = getType ("MSG_PROCESS_LINK", getRootType());
     new_pajeStartLink (MSG_get_clock(), getRootContainer(), type, msg, "M", key);
 
     //destroy existing container of this process
@@ -51,12 +51,12 @@ void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host, m_hos
 //    new_pajeSetVariable (MSG_get_clock(), msg, type, 1);
 
     //set the state of this new container
-    type = getType ("MSG_PROCESS_STATE");
+    type = getType ("MSG_PROCESS_STATE", msg->type);
     new_pajeSetState (MSG_get_clock(), msg, type, "executing");
 
     //end link
     msg = getContainer(instr_process_id(process, str, len));
-    type = getType ("MSG_PROCESS_LINK");
+    type = getType ("MSG_PROCESS_LINK", getRootType());
     new_pajeEndLink (MSG_get_clock(), getRootContainer(), type, msg, "M", key);
   }
 }
@@ -76,7 +76,7 @@ void TRACE_msg_process_create (m_process_t process)
 //    }
 //    new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
 
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", msg->type);
     new_pajeSetState (MSG_get_clock(), msg, type, "executing");
   }
 }
@@ -99,7 +99,7 @@ void TRACE_msg_process_suspend(m_process_t process)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(process, str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePushState (MSG_get_clock(), process_container, type, "suspend");
   }
 }
@@ -111,7 +111,7 @@ void TRACE_msg_process_resume(m_process_t process)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(process, str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePopState (MSG_get_clock(), process_container, type);
   }
 }
@@ -123,7 +123,7 @@ void TRACE_msg_process_sleep_in(m_process_t process)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(process, str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePushState (MSG_get_clock(), process_container, type, "sleep");
   }
 }
@@ -135,7 +135,7 @@ void TRACE_msg_process_sleep_out(m_process_t process)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(process, str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePopState (MSG_get_clock(), process_container, type);
   }
 }
index 3821012..46d28b0 100644 (file)
@@ -48,13 +48,13 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category)
         "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);
-    type_t type = getType (task->category);
+    type_t type = getType (task->category, msg->type);
     if (!type){
       type = getVariableType(task->category, NULL, msg->type);
     }
     new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
 
-    type = getType ("MSG_TASK_STATE");
+    type = getType ("MSG_TASK_STATE", msg->type);
     new_pajePushState (MSG_get_clock(), msg, type, "created");
   }
 }
@@ -75,7 +75,7 @@ void TRACE_msg_task_execute_start(m_task_t task)
 
   if (TRACE_msg_task_is_enabled()){
     container_t task_container = getContainer (task->name);
-    type_t type = getType ("MSG_TASK_STATE");
+    type_t type = getType ("MSG_TASK_STATE", task_container->type);
     new_pajePushState (MSG_get_clock(), task_container, type, "MSG_task_execute");
   }
 
@@ -84,7 +84,7 @@ void TRACE_msg_task_execute_start(m_task_t task)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePushState (MSG_get_clock(), process_container, type, "task_execute");
   }
 }
@@ -95,7 +95,7 @@ void TRACE_msg_task_execute_end(m_task_t task)
 
   if (TRACE_msg_task_is_enabled()){
     container_t task_container = getContainer (task->name);
-    type_t type = getType ("MSG_TASK_STATE");
+    type_t type = getType ("MSG_TASK_STATE", task_container->type);
     new_pajePopState (MSG_get_clock(), task_container, type);
   }
 
@@ -104,7 +104,7 @@ void TRACE_msg_task_execute_end(m_task_t task)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePopState (MSG_get_clock(), process_container, type);
   }
 }
@@ -139,7 +139,7 @@ void TRACE_msg_task_get_start(void)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePushState (MSG_get_clock(), process_container, type, "receive");
   }
 }
@@ -158,13 +158,13 @@ void TRACE_msg_task_get_end(double start_time, m_task_t 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);
-    type_t type = getType (task->category);
+    type_t type = getType (task->category, msg->type);
     new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1);
 
-    type = getType ("MSG_TASK_STATE");
+    type = getType ("MSG_TASK_STATE", msg->type);
     new_pajePushState (MSG_get_clock(), msg, type, "created");
 
-    type = getType ("MSG_TASK_LINK");
+    type = getType ("MSG_TASK_LINK", getRootType());
     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);
@@ -175,12 +175,12 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePopState (MSG_get_clock(), process_container, type);
 
     char key[INSTR_DEFAULT_STR_SIZE];
     snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
-    type = getType ("MSG_PROCESS_TASK_LINK");
+    type = getType ("MSG_PROCESS_TASK_LINK", getRootType());
     new_pajeEndLink(MSG_get_clock(), getRootContainer(), type, process_container, "SR", key);
   }
 }
@@ -193,10 +193,10 @@ int TRACE_msg_task_put_start(m_task_t task)
   if (TRACE_msg_task_is_enabled()){
 
     container_t msg = getContainer (task->name);
-    type_t type = getType ("MSG_TASK_STATE");
+    type_t type = getType ("MSG_TASK_STATE", msg->type);
     new_pajePopState (MSG_get_clock(), msg, type);
 
-    type = getType ("MSG_TASK_LINK");
+    type = getType ("MSG_TASK_LINK", getRootType());
     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);
@@ -214,12 +214,12 @@ int TRACE_msg_task_put_start(m_task_t task)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePushState (MSG_get_clock(), process_container, type, "send");
 
     char key[INSTR_DEFAULT_STR_SIZE];
     snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
-    type = getType ("MSG_PROCESS_TASK_LINK");
+    type = getType ("MSG_PROCESS_TASK_LINK", getRootType());
     new_pajeStartLink(MSG_get_clock(), getRootContainer(), type, process_container, "SR", key);
   }
 
@@ -239,7 +239,7 @@ void TRACE_msg_task_put_end(void)
     char str[INSTR_DEFAULT_STR_SIZE];
 
     container_t process_container = getContainer (instr_process_id(MSG_process_self(), str, len));
-    type_t type = getType ("MSG_PROCESS_STATE");
+    type_t type = getType ("MSG_PROCESS_STATE", process_container->type);
     new_pajePopState (MSG_get_clock(), process_container, type);
   }
 }
index 7bc4bbf..462955a 100644 (file)
@@ -239,9 +239,9 @@ static type_t recursiveGetType (const char *name, type_t root)
   return NULL;
 }
 
-type_t getType (const char *name)
+type_t getType (const char *name, type_t father)
 {
-  return recursiveGetType (name, rootType);
+  return recursiveGetType (name, father);
 }
 
 void destroyContainer (container_t container)
index bf35c82..1981f54 100644 (file)
@@ -207,7 +207,7 @@ type_t getEventType (const char *name, const char *color, type_t father);
 type_t getVariableType (const char *name, const char *color, type_t father);
 type_t getLinkType (const char *name, type_t father, type_t source, type_t dest);
 type_t getStateType (const char *name, type_t father);
-type_t getType (const char *name);
+type_t getType (const char *name, type_t father);
 void destroyContainer (container_t container);
 void destroyAllContainers (void);
 
index f263757..49aeae9 100644 (file)
@@ -133,7 +133,7 @@ void TRACE_smpi_collective_in(int rank, int root, const char *operation)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = getContainer (str);
-  type_t type = getType ("MPI_STATE");
+  type_t type = getType ("MPI_STATE", container->type);
 
   new_pajePushState (SIMIX_get_clock(), container, type, operation);
 }
@@ -145,7 +145,7 @@ void TRACE_smpi_collective_out(int rank, int root, const char *operation)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = getContainer (str);
-  type_t type = getType ("MPI_STATE");
+  type_t type = getType ("MPI_STATE", container->type);
 
   new_pajePopState (SIMIX_get_clock(), container, type);
 }
@@ -157,7 +157,7 @@ void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = getContainer (str);
-  type_t type = getType ("MPI_STATE");
+  type_t type = getType ("MPI_STATE", container->type);
 
   new_pajePushState (SIMIX_get_clock(), container, type, operation);
 }
@@ -169,7 +169,7 @@ void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = getContainer (str);
-  type_t type = getType ("MPI_STATE");
+  type_t type = getType ("MPI_STATE", container->type);
 
   new_pajePopState (SIMIX_get_clock(), container, type);
 }
@@ -184,7 +184,7 @@ void TRACE_smpi_send(int rank, int src, int dst)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(src, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = getContainer (str);
-  type_t type = getType ("MPI_LINK");
+  type_t type = getType ("MPI_LINK", getRootType());
 
   new_pajeStartLink (SIMIX_get_clock(), getRootContainer(), type, container, "PTP", key);
 }
@@ -199,7 +199,7 @@ void TRACE_smpi_recv(int rank, int src, int dst)
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(dst, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = getContainer (str);
-  type_t type = getType ("MPI_LINK");
+  type_t type = getType ("MPI_LINK", getRootType());
 
   new_pajeEndLink (SIMIX_get_clock(), getRootContainer(), type, container, "PTP", key);
 }