summaryrefslogtreecommitdiff
path: root/rts/Trace.h
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-08-06 11:51:35 -0400
committerBen Gamari <ben@smart-cactus.org>2022-08-06 11:51:35 -0400
commit6d1700b6dca6defb8768c493a1059c4215749b53 (patch)
tree80dc3968bb4073cd6f06e39a040f32a5a5360e31 /rts/Trace.h
parentaa818a9f83308d0742e8f8c91cb9878182dacce5 (diff)
downloadhaskell-6d1700b6dca6defb8768c493a1059c4215749b53.tar.gz
rts: Move thread labels into TSO
This eliminates the thread label HashTable and instead tracks this information in the TSO, allowing us to use proper StgArrBytes arrays for backing the label and greatly simplifying management of object lifetimes when we expose them to the user with the coming `threadLabel#` primop.
Diffstat (limited to 'rts/Trace.h')
-rw-r--r--rts/Trace.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/rts/Trace.h b/rts/Trace.h
index a4fa166594..8c65972954 100644
--- a/rts/Trace.h
+++ b/rts/Trace.h
@@ -229,7 +229,8 @@ void traceUserBinaryMsg(Capability *cap, uint8_t *msg, size_t size);
*/
void traceThreadLabel_(Capability *cap,
StgTSO *tso,
- char *label);
+ char *label,
+ size_t len);
/*
* Emit a debug message (only when DEBUG is defined)
@@ -361,7 +362,7 @@ void flushTrace(void);
#define debugTrace(class, str, ...) /* nothing */
#define debugTraceCap(class, cap, str, ...) /* nothing */
#define traceThreadStatus(class, tso) /* nothing */
-#define traceThreadLabel_(cap, tso, label) /* nothing */
+#define traceThreadLabel_(cap, tso, label, len) /* nothing */
#define traceCapEvent(cap, tag) /* nothing */
#define traceCapsetEvent(tag, capset, info) /* nothing */
#define traceWallClockTime_() /* nothing */
@@ -430,8 +431,8 @@ void dtraceUserMarkerWrapper(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)
+#define dtraceThreadLabel(cap, tso, label, len) \
+ HASKELLEVENT_THREAD_LABEL(cap, tso, label, len)
#define dtraceCapCreate(cap) \
HASKELLEVENT_CAP_CREATE(cap)
#define dtraceCapDelete(cap) \
@@ -526,7 +527,7 @@ void dtraceUserMarkerWrapper(Capability *cap, char *msg);
#define dtraceRequestSeqGc(cap) /* nothing */
#define dtraceRequestParGc(cap) /* nothing */
#define dtraceCreateSparkThread(cap, spark_tid) /* nothing */
-#define dtraceThreadLabel(cap, tso, label) /* nothing */
+#define dtraceThreadLabel(cap, tso, label, len) /* nothing */
#define dtraceUserMsg(cap, msg) /* nothing */
#define dtraceUserMarker(cap, msg) /* nothing */
#define dtraceGcIdle(cap) /* nothing */
@@ -667,12 +668,13 @@ INLINE_HEADER void traceEventThreadWakeup(Capability *cap STG_UNUSED,
INLINE_HEADER void traceThreadLabel(Capability *cap STG_UNUSED,
StgTSO *tso STG_UNUSED,
- char *label STG_UNUSED)
+ char *label STG_UNUSED,
+ size_t len STG_UNUSED)
{
if (RTS_UNLIKELY(TRACE_sched)) {
- traceThreadLabel_(cap, tso, label);
+ traceThreadLabel_(cap, tso, label, len);
}
- dtraceThreadLabel((EventCapNo)cap->no, (EventThreadID)tso->id, label);
+ dtraceThreadLabel((EventCapNo)cap->no, (EventThreadID)tso->id, label, len);
}
INLINE_HEADER void traceEventGcStart(Capability *cap STG_UNUSED)