summaryrefslogtreecommitdiff
path: root/rts/ThreadLabels.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/ThreadLabels.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/ThreadLabels.c')
-rw-r--r--rts/ThreadLabels.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/rts/ThreadLabels.c b/rts/ThreadLabels.c
index 6d2a5d641d..8838042a83 100644
--- a/rts/ThreadLabels.c
+++ b/rts/ThreadLabels.c
@@ -13,12 +13,13 @@
#include "ThreadLabels.h"
#include "RtsUtils.h"
#include "Hash.h"
+#include "Trace.h"
#include <stdlib.h>
#include <string.h>
#if defined(DEBUG)
-/* to the end */
+
static HashTable * threadLabels = NULL;
void
@@ -61,9 +62,14 @@ removeThreadLabel(StgWord key)
}
}
+#endif /* DEBUG */
+
void
-labelThread(StgPtr tso, char *label)
+labelThread(Capability *cap STG_UNUSED,
+ StgTSO *tso STG_UNUSED,
+ char *label STG_UNUSED)
{
+#if defined(DEBUG)
int len;
void *buf;
@@ -72,7 +78,8 @@ labelThread(StgPtr tso, char *label)
buf = stgMallocBytes(len * sizeof(char), "Schedule.c:labelThread()");
strncpy(buf,label,len);
/* Update will free the old memory for us */
- updateThreadLabel(((StgTSO *)tso)->id,buf);
+ updateThreadLabel(tso->id,buf);
+#endif
+ traceThreadLabel(cap, tso, label);
}
-#endif /* DEBUG */