Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] use of xbt functions inside instr
[simgrid.git] / src / instr / instr_paje.c
index ad83fd1..3812aa7 100644 (file)
@@ -8,6 +8,8 @@
 
 #ifdef HAVE_TRACING
 
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje, instr, "Paje tracing event system");
+
 static FILE *tracing_file = NULL;
 
 static int pajeDefineContainerTypeId = 0;
@@ -45,21 +47,24 @@ void TRACE_paje_start(void)
 {
   char *filename = TRACE_get_filename();
   tracing_file = fopen(filename, "w");
-  if (!tracing_file) {
-    THROW1(tracing_error, TRACE_ERROR_FILE_OPEN,
-           "Tracefile %s could not be opened for writing.", filename);
-  }
+  xbt_assert1 (tracing_file != NULL, "Tracefile %s could not be opened for writing.", filename);
+
+  DEBUG1("Filename %s is open for writing", filename);
+
+  /* output header */
+  TRACE_paje_create_header();
 }
 
 void TRACE_paje_end(void)
 {
   fclose(tracing_file);
+  char *filename = TRACE_get_filename();
+  DEBUG1("Filename %s is closed", filename);
 }
 
 void TRACE_paje_create_header(void)
 {
-  if (!TRACE_is_active())
-    return;
+  DEBUG0 ("Define paje header");
   fprintf(tracing_file, "\
 %%EventDef PajeDefineContainerType %d \n\
 %%       Alias string \n\