From 3db8a9be9f89fe76e0a27f24ab02977974b6613f Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 16 Sep 2009 14:23:15 +0000 Subject: [PATCH] only create the .eventlog file if any tracing options are enabled --- rts/Trace.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/rts/Trace.c b/rts/Trace.c index 20debdc..8991033 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -19,6 +19,7 @@ #include "Threads.h" #include "Printer.h" +#ifdef DEBUG // debugging flags, set with +RTS -D int DEBUG_sched; int DEBUG_interp; @@ -36,6 +37,7 @@ int DEBUG_linker; int DEBUG_squeeze; int DEBUG_hpc; int DEBUG_sparks; +#endif // events int TRACE_sched; @@ -44,6 +46,8 @@ int TRACE_sched; static Mutex trace_utx; #endif +static rtsBool eventlog_enabled; + /* --------------------------------------------------------------------------- Starting up / shuttting down the tracing facilities --------------------------------------------------------------------------- */ @@ -81,17 +85,42 @@ void initTracing (void) TRACE_FLAG(scheduler, TRACE_sched); - initEventLogging(); + eventlog_enabled = !RtsFlags.TraceFlags.trace_stderr && ( + TRACE_sched +#ifdef DEBUG + | DEBUG_sched + | DEBUG_interp + | DEBUG_weak + | DEBUG_gccafs + | DEBUG_gc + | DEBUG_block_alloc + | DEBUG_sanity + | DEBUG_stable + | DEBUG_stm + | DEBUG_prof + | DEBUG_linker + | DEBUG_squeeze + | DEBUG_hpc +#endif + ); + + if (eventlog_enabled) { + initEventLogging(); + } } void endTracing (void) { - endEventLogging(); + if (eventlog_enabled) { + endEventLogging(); + } } void freeTracing (void) { - freeEventLogging(); + if (eventlog_enabled) { + freeEventLogging(); + } } /* --------------------------------------------------------------------------- -- 1.7.10.4