Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] simpler verifications to see what is enabled before tracing
[simgrid.git] / src / instr / instr_smpi.c
index 84f567a..f263757 100644 (file)
@@ -86,23 +86,22 @@ void TRACE_smpi_alloc()
 
 void TRACE_smpi_start(void)
 {
-  if (TRACE_smpi_is_enabled()) {
-    TRACE_start();
-  }
+  if (!TRACE_smpi_is_enabled()) return;
+
+  TRACE_start();
 }
 
 void TRACE_smpi_release(void)
 {
+  if (!TRACE_smpi_is_enabled()) return;
+
   TRACE_surf_release();
-  if (TRACE_smpi_is_enabled()) {
-    TRACE_end();
-  }
+  TRACE_end();
 }
 
 void TRACE_smpi_init(int rank)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
@@ -120,8 +119,7 @@ void TRACE_smpi_init(int rank)
 
 void TRACE_smpi_finalize(int rank)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
@@ -130,60 +128,55 @@ void TRACE_smpi_finalize(int rank)
 
 void TRACE_smpi_collective_in(int rank, int root, const char *operation)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   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");
 
-  pajePushState(SIMIX_get_clock(), type->id, container->id, operation);
+  new_pajePushState (SIMIX_get_clock(), container, type, operation);
 }
 
 void TRACE_smpi_collective_out(int rank, int root, const char *operation)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   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");
 
-  pajePopState(SIMIX_get_clock(), type->id, container->id);
+  new_pajePopState (SIMIX_get_clock(), container, type);
 }
 
 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   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");
 
-  pajePushState(SIMIX_get_clock(), type->id, container->id, operation);
+  new_pajePushState (SIMIX_get_clock(), container, type, operation);
 }
 
 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   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");
 
-  pajePopState(SIMIX_get_clock(), type->id, container->id);
+  new_pajePopState (SIMIX_get_clock(), container, type);
 }
 
 void TRACE_smpi_send(int rank, int src, int dst)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   char key[INSTR_DEFAULT_STR_SIZE];
   TRACE_smpi_put_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
@@ -193,13 +186,12 @@ void TRACE_smpi_send(int rank, int src, int dst)
   container_t container = getContainer (str);
   type_t type = getType ("MPI_LINK");
 
-  pajeStartLink(SIMIX_get_clock(), type->id, type->father->id, "PTP", container->id, key);
+  new_pajeStartLink (SIMIX_get_clock(), getRootContainer(), type, container, "PTP", key);
 }
 
 void TRACE_smpi_recv(int rank, int src, int dst)
 {
-  if (!TRACE_smpi_is_enabled())
-    return;
+  if (!TRACE_smpi_is_enabled()) return;
 
   char key[INSTR_DEFAULT_STR_SIZE];
   TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
@@ -209,6 +201,6 @@ void TRACE_smpi_recv(int rank, int src, int dst)
   container_t container = getContainer (str);
   type_t type = getType ("MPI_LINK");
 
-  pajeEndLink(SIMIX_get_clock(), type->id, type->father->id, "PTP", container->id, key);
+  new_pajeEndLink (SIMIX_get_clock(), getRootContainer(), type, container, "PTP", key);
 }
 #endif /* HAVE_TRACING */