Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
trace: functions to generate links, append a link type in the hierarchy of types
[simgrid.git] / src / instr / interface.c
index 57157ce..88a0576 100644 (file)
@@ -16,15 +16,25 @@ static xbt_dict_t created_categories;
 
 int TRACE_start ()
 {
-       FILE *file = NULL;
+  if (!_TRACE_configured()){
+    THROW0 (tracing_error, TRACE_ERROR_START,
+            "TRACE_start should be called after SimGrid initialization functions.");
+    return 0;
+  }
+
   if (IS_TRACING) { /* what? trace is already active... ignore.. */
-       THROW0 (tracing_error, TRACE_ERROR_START,
-               "TRACE_start called, but tracing is already active");
+    THROW0 (tracing_error, TRACE_ERROR_START,
+                "TRACE_start called, but tracing is already active.");
     return 0;
   }
 
   char *filename = _TRACE_filename ();
-  file = fopen(filename, "w");
+  if (!filename){
+    THROW0 (tracing_error, TRACE_ERROR_START,
+            "Trace filename is not initialized.");
+    return 0;
+  }
+  FILE *file = fopen(filename, "w");
   if (!file) {
     THROW1 (tracing_error, TRACE_ERROR_START,
                "Tracefile %s could not be opened for writing.", filename);
@@ -65,6 +75,12 @@ int TRACE_start ()
     pajeDefineStateType("presence", "TASK", "presence");
   }
 
+  if (IS_TRACING_SMPI){
+    pajeDefineContainerType ("MPI_PROCESS", "HOST", "MPI_PROCESS");
+    pajeDefineStateType ("MPI_STATE", "MPI_PROCESS", "MPI_STATE");
+    pajeDefineLinkType ("MPI_LINK", "0", "MPI_PROCESS", "MPI_PROCESS", "MPI_LINK");
+  }
+
   /* creating the platform */
   pajeCreateContainer(MSG_get_clock(), "platform", "PLATFORM", "0", "simgrid-platform");
 
@@ -74,6 +90,7 @@ int TRACE_start ()
   __TRACE_msg_init();
   __TRACE_surf_init();
   __TRACE_msg_process_init ();
+  __TRACE_smpi_init ();
 
   return 0;
 }