diff options
author | Duncan Coutts <duncan@well-typed.com> | 2011-11-02 12:02:09 +0000 |
---|---|---|
committer | Duncan Coutts <duncan@well-typed.com> | 2011-11-04 14:13:10 +0000 |
commit | c739d845f9b3fc67ee20aa3de7e876cb1327bb1a (patch) | |
tree | c3139330cdaa227854aa5fda007dd37e213d9295 /rts/Trace.h | |
parent | d416d943ef59bafa0add5685ee0687f25db2d276 (diff) | |
download | haskell-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.h')
-rw-r--r-- | rts/Trace.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rts/Trace.h b/rts/Trace.h index a0c5e26e2d..8dacb80eda 100644 --- a/rts/Trace.h +++ b/rts/Trace.h @@ -152,9 +152,18 @@ void trace_(char *msg, ...); /* * A message or event emitted by the program + * Used by Debug.Trace.{traceEvent, traceEventIO} */ void traceUserMsg(Capability *cap, char *msg); +/* + * An event to record a Haskell thread's label/name + * Used by GHC.Conc.labelThread + */ +void traceThreadLabel_(Capability *cap, + StgTSO *tso, + char *label); + /* * Emit a debug message (only when DEBUG is defined) */ @@ -221,6 +230,7 @@ void traceSparkCounters_ (Capability *cap, #define debugTrace(class, str, ...) /* nothing */ #define debugTraceCap(class, cap, str, ...) /* nothing */ #define traceThreadStatus(class, tso) /* nothing */ +#define traceThreadLabel_(cap, tso, label) /* nothing */ INLINE_HEADER void traceEventStartup_ (int n_caps STG_UNUSED) {}; #define traceCapsetEvent_(tag, capset, info) /* nothing */ #define traceWallClockTime_() /* nothing */ @@ -268,6 +278,8 @@ void dtraceUserMsgWrapper(Capability *cap, char *msg); HASKELLEVENT_REQUEST_PAR_GC(cap) #define dtraceCreateSparkThread(cap, spark_tid) \ HASKELLEVENT_CREATE_SPARK_THREAD(cap, spark_tid) +#define dtraceThreadLabel(cap, tso, label) \ + HASKELLEVENT_THREAD_LABEL(cap, tso, label) INLINE_HEADER void dtraceStartup (int num_caps) { HASKELLEVENT_STARTUP(num_caps); } @@ -318,6 +330,7 @@ INLINE_HEADER void dtraceStartup (int num_caps) { #define dtraceRequestSeqGc(cap) /* nothing */ #define dtraceRequestParGc(cap) /* nothing */ #define dtraceCreateSparkThread(cap, spark_tid) /* nothing */ +#define dtraceThreadLabel(cap, tso, label) /* nothing */ INLINE_HEADER void dtraceStartup (int num_caps STG_UNUSED) {}; #define dtraceUserMsg(cap, msg) /* nothing */ #define dtraceGcIdle(cap) /* nothing */ @@ -414,6 +427,16 @@ INLINE_HEADER void traceEventThreadWakeup(Capability *cap STG_UNUSED, (EventCapNo)other_cap); } +INLINE_HEADER void traceThreadLabel(Capability *cap STG_UNUSED, + StgTSO *tso STG_UNUSED, + char *label STG_UNUSED) +{ + if (RTS_UNLIKELY(TRACE_sched)) { + traceThreadLabel_(cap, tso, label); + } + dtraceThreadLabel((EventCapNo)cap->no, (EventThreadID)tso->id, label); +} + INLINE_HEADER void traceEventGcStart(Capability *cap STG_UNUSED) { traceGcEvent(cap, EVENT_GC_START); |