summaryrefslogtreecommitdiff
path: root/rts/Trace.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-09-16 14:23:15 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-09-16 14:23:15 +0000
commit3db8a9be9f89fe76e0a27f24ab02977974b6613f (patch)
treec9d819412482c956300ec06a06a94961e23c798b /rts/Trace.c
parentc2cd83e7d85c11e6a33e1cde263eb2312566d535 (diff)
downloadhaskell-3db8a9be9f89fe76e0a27f24ab02977974b6613f.tar.gz
only create the .eventlog file if any tracing options are enabled
Diffstat (limited to 'rts/Trace.c')
-rw-r--r--rts/Trace.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/rts/Trace.c b/rts/Trace.c
index 20debdca5b..8991033213 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<something>
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();
+ }
}
/* ---------------------------------------------------------------------------