summaryrefslogtreecommitdiff
path: root/rts/Trace.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2011-11-02 12:02:09 +0000
committerDuncan Coutts <duncan@well-typed.com>2011-11-04 14:13:10 +0000
commitc739d845f9b3fc67ee20aa3de7e876cb1327bb1a (patch)
treec3139330cdaa227854aa5fda007dd37e213d9295 /rts/Trace.c
parentd416d943ef59bafa0add5685ee0687f25db2d276 (diff)
downloadhaskell-c739d845f9b3fc67ee20aa3de7e876cb1327bb1a.tar.gz
Add eventlog event for thread labels
The existing GHC.Conc.labelThread will now also emit the the thread label into the eventlog. Profiling tools like ThreadScope could then use the thread labels rather than thread numbers.
Diffstat (limited to 'rts/Trace.c')
-rw-r--r--rts/Trace.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/rts/Trace.c b/rts/Trace.c
index a3aa266c4e..1671bfeb36 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -547,6 +547,24 @@ void traceUserMsg(Capability *cap, char *msg)
traceFormatUserMsg(cap, "%s", msg);
}
+void traceThreadLabel_(Capability *cap,
+ StgTSO *tso,
+ char *label)
+{
+#ifdef DEBUG
+ if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
+ ACQUIRE_LOCK(&trace_utx);
+ tracePreface();
+ debugBelch("cap %d: thread %lu has label %s\n",
+ cap->no, (lnat)tso->id, label);
+ RELEASE_LOCK(&trace_utx);
+ } else
+#endif
+ {
+ postThreadLabel(cap, tso->id, label);
+ }
+}
+
void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
{
#ifdef DEBUG