int TRACE_start()
{
- if (!TRACE_is_configured()) {
- THROW0(tracing_error, TRACE_ERROR_START,
- "TRACE_start should be called after SimGrid initialization functions.");
- return 0;
- }
-
- if (!TRACE_is_enabled()){
- 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.");
+ // tracing system must be:
+ // - enabled (with --cfg=tracing:1)
+ // - already configured (TRACE_global_init already called)
+ if (!(TRACE_is_enabled() && TRACE_is_configured())){
return 0;
}
+ /* open the trace file */
char *filename = TRACE_get_filename();
if (!filename) {
THROW0(tracing_error, TRACE_ERROR_START,
} else {
TRACE_paje_start(file);
}
+
+ /* activate trace */
+ TRACE_activate ();
+
+ /* output header */
TRACE_paje_create_header();
/* define paje hierarchy for tracing */
TRACE_surf_alloc();
TRACE_msg_process_alloc();
TRACE_smpi_alloc();
-
return 0;
}
int TRACE_end()
{
- FILE *file = NULL;
- if (!IS_TRACING)
+ if (!TRACE_is_active())
return 1;
- file = TRACE_paje_end();
+ FILE *file = TRACE_paje_end();
fclose(file);
+
+ TRACE_desactivate ();
return 0;
}
int TRACE_category_with_color (const char *category, const char *color)
{
static int first_time = 1;
- if (!IS_TRACING)
+ if (!TRACE_is_active())
return 1;
if (first_time) {
const char *parent_type, int final)
{
char *val_one = NULL;
- if (!IS_TRACING)
+ if (!TRACE_is_active())
return;
//check if type is already defined
{
char state[100];
char *val_one = NULL;
- if (!IS_TRACING)
+ if (!TRACE_is_active())
return 1;
//check if type is defined
void TRACE_declare_mark(const char *mark_type)
{
- if (!IS_TRACING)
+ if (!TRACE_is_active())
return;
if (!mark_type)
return;
void TRACE_mark(const char *mark_type, const char *mark_value)
{
- if (!IS_TRACING)
+ if (!TRACE_is_active())
return;
if (!mark_type || !mark_value)
return;