#ifdef HAVE_TRACING
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje, instr, "Paje tracing event system");
+
static FILE *tracing_file = NULL;
-int tracing_active = 0;
static int pajeDefineContainerTypeId = 0;
static int pajeDefineStateTypeId = 1;
#define TRACE_LINE_SIZE 1000
-void TRACE_paje_start(FILE * file)
+void TRACE_paje_start(void)
{
- tracing_file = file;
- tracing_active = 1;
+ char *filename = TRACE_get_filename();
+ tracing_file = fopen(filename, "w");
+ 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();
}
-FILE *TRACE_paje_end(void)
+void TRACE_paje_end(void)
{
- tracing_active = 0;
- return tracing_file;
+ fclose(tracing_file);
+ char *filename = TRACE_get_filename();
+ DEBUG1("Filename %s is closed", filename);
}
-
void TRACE_paje_create_header(void)
{
- if (!tracing_active)
- return;
+ DEBUG0 ("Define paje header");
fprintf(tracing_file, "\
%%EventDef PajeDefineContainerType %d \n\
%% Alias string \n\
entityType, container, value);
}
-#endif
+#endif /* HAVE_TRACING */