diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-03-17 16:42:14 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-03-17 16:42:14 +0000 |
commit | 8b18faef8aeaf40150c208272a2fc117611e8ae8 (patch) | |
tree | 2aabc6115dccd0a3e303320515564b5628c8771c /rts/Trace.h | |
parent | f8f4cb3f3a46e0495917a927cefe906531b7b38e (diff) | |
download | haskell-8b18faef8aeaf40150c208272a2fc117611e8ae8.tar.gz |
Add fast event logging
Generate binary log files from the RTS containing a log of runtime
events with timestamps. The log file can be visualised in various
ways, for investigating runtime behaviour and debugging performance
problems. See for example the forthcoming ThreadScope viewer.
New GHC option:
-eventlog (link-time option) Enables event logging.
+RTS -l (runtime option) Generates <prog>.eventlog with
the binary event information.
This replaces some of the tracing machinery we already had in the RTS:
e.g. +RTS -vg for GC tracing (we should do this using the new event
logging instead).
Event logging has almost no runtime cost when it isn't enabled, though
in the future we might add more fine-grained events and this might
change; hence having a link-time option and compiling a separate
version of the RTS for event logging. There's a small runtime cost
for enabling event-logging, for most programs it shouldn't make much
difference.
(Todo: docs)
Diffstat (limited to 'rts/Trace.h')
-rw-r--r-- | rts/Trace.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/rts/Trace.h b/rts/Trace.h index 0e142f5238..fc19e8957a 100644 --- a/rts/Trace.h +++ b/rts/Trace.h @@ -2,16 +2,14 @@ * * (c) The GHC Team 2006 * - * Debug and performance tracing. + * Debug tracing. * * This is a layer over RtsMessages, which provides for generating - * trace messages with timestamps and thread Ids attached + * trace messages with timestamps and task IDs attached * automatically. Also, multiple classes of messages are supported, * which can be enabled separately via RTS flags. * - * All debug trace messages go through here. Additionally, we - * generate timestamped trace messages for consumption by profiling - * tools using this API. + * All debug trace messages go through here. * * ---------------------------------------------------------------------------*/ @@ -22,6 +20,8 @@ // Tracing functions // ----------------------------------------------------------------------------- +#ifdef DEBUG + void initTracing (void); // The simple way: @@ -42,17 +42,18 @@ void traceBegin (const char *str, ...) void traceEnd (void); -#ifdef DEBUG #define debugTrace(class, str, ...) trace(class,str, ## __VA_ARGS__) // variable arg macros are C99, and supported by gcc. #define debugTraceBegin(str, ...) traceBegin(str, ## __VA_ARGS__) #define debugTraceEnd() traceEnd() -#else + +#else /* !DEBUG */ + #define debugTrace(class, str, ...) /* nothing */ #define debugTraceBegin(str, ...) /* nothing */ #define debugTraceEnd() /* nothing */ -#endif +#endif // ----------------------------------------------------------------------------- // Message classes, these may be OR-ed together @@ -74,10 +75,7 @@ void traceEnd (void); #define DEBUG_linker (1<<12) #define DEBUG_squeeze (1<<13) #define DEBUG_hpc (1<<14) - -// Tracing flags -#define TRACE_sched (1<<20) -#define TRACE_gc (1<<21) +#define DEBUG_eventlog (1<<15) // ----------------------------------------------------------------------------- // PRIVATE below here |