projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix #3578: return a dummy result when an STM transaction is aborted
[ghc-hetmet.git]
/
rts
/
Trace.c
diff --git
a/rts/Trace.c
b/rts/Trace.c
index
20debdc
..
81a2eb2
100644
(file)
--- a/
rts/Trace.c
+++ b/
rts/Trace.c
@@
-19,6
+19,7
@@
#include "Threads.h"
#include "Printer.h"
#include "Threads.h"
#include "Printer.h"
+#ifdef DEBUG
// debugging flags, set with +RTS -D<something>
int DEBUG_sched;
int DEBUG_interp;
// 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;
int DEBUG_squeeze;
int DEBUG_hpc;
int DEBUG_sparks;
+#endif
// events
int TRACE_sched;
// events
int TRACE_sched;
@@
-44,6
+46,8
@@
int TRACE_sched;
static Mutex trace_utx;
#endif
static Mutex trace_utx;
#endif
+static rtsBool eventlog_enabled;
+
/* ---------------------------------------------------------------------------
Starting up / shuttting down the tracing facilities
--------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------
Starting up / shuttting down the tracing facilities
--------------------------------------------------------------------------- */
@@
-59,7
+63,6
@@
void initTracing (void)
class = RtsFlags.DebugFlags.name ? 1 : 0;
DEBUG_FLAG(scheduler, DEBUG_sched);
class = RtsFlags.DebugFlags.name ? 1 : 0;
DEBUG_FLAG(scheduler, DEBUG_sched);
- DEBUG_FLAG(scheduler, TRACE_sched); // -Ds enabled all sched events
DEBUG_FLAG(interpreter, DEBUG_interp);
DEBUG_FLAG(weak, DEBUG_weak);
DEBUG_FLAG(interpreter, DEBUG_interp);
DEBUG_FLAG(weak, DEBUG_weak);
@@
-76,22
+79,30
@@
void initTracing (void)
DEBUG_FLAG(sparks, DEBUG_sparks);
#endif
DEBUG_FLAG(sparks, DEBUG_sparks);
#endif
-#define TRACE_FLAG(name, class) \
- class = RtsFlags.TraceFlags.name ? 1 : 0;
+ // -Ds turns on scheduler tracing too
+ TRACE_sched =
+ RtsFlags.TraceFlags.scheduler ||
+ RtsFlags.DebugFlags.scheduler;
- TRACE_FLAG(scheduler, TRACE_sched);
+ eventlog_enabled = RtsFlags.TraceFlags.tracing == TRACE_EVENTLOG;
- initEventLogging();
+ if (eventlog_enabled) {
+ initEventLogging();
+ }
}
void endTracing (void)
{
}
void endTracing (void)
{
- endEventLogging();
+ if (eventlog_enabled) {
+ endEventLogging();
+ }
}
void freeTracing (void)
{
}
void freeTracing (void)
{
- freeEventLogging();
+ if (eventlog_enabled) {
+ freeEventLogging();
+ }
}
/* ---------------------------------------------------------------------------
}
/* ---------------------------------------------------------------------------
@@
-196,7
+207,7
@@
void traceSchedEvent_ (Capability *cap, EventTypeNum tag,
StgTSO *tso, StgWord64 other)
{
#ifdef DEBUG
StgTSO *tso, StgWord64 other)
{
#ifdef DEBUG
- if (RtsFlags.TraceFlags.trace_stderr) {
+ if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
traceSchedEvent_stderr(cap, tag, tso, other);
} else
#endif
traceSchedEvent_stderr(cap, tag, tso, other);
} else
#endif
@@
-225,7
+236,7
@@
void traceCap_(Capability *cap, char *msg, ...)
va_start(ap,msg);
#ifdef DEBUG
va_start(ap,msg);
#ifdef DEBUG
- if (RtsFlags.TraceFlags.trace_stderr) {
+ if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
traceCap_stderr(cap, msg, ap);
} else
#endif
traceCap_stderr(cap, msg, ap);
} else
#endif
@@
-255,7
+266,7
@@
void trace_(char *msg, ...)
va_start(ap,msg);
#ifdef DEBUG
va_start(ap,msg);
#ifdef DEBUG
- if (RtsFlags.TraceFlags.trace_stderr) {
+ if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
trace_stderr(msg, ap);
} else
#endif
trace_stderr(msg, ap);
} else
#endif
@@
-266,10
+277,24
@@
void trace_(char *msg, ...)
va_end(ap);
}
va_end(ap);
}
+void traceUserMsg(Capability *cap, char *msg)
+{
+#ifdef DEBUG
+ if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
+ traceCap_stderr(cap, msg, NULL);
+ } else
+#endif
+ {
+ if (eventlog_enabled) {
+ postUserMsg(cap, msg);
+ }
+ }
+}
+
void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
{
#ifdef DEBUG
void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
{
#ifdef DEBUG
- if (RtsFlags.TraceFlags.trace_stderr) {
+ if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
printThreadStatus(tso);
} else
#endif
printThreadStatus(tso);
} else
#endif