summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-01-27 16:42:26 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-01-27 16:42:26 +0000
commit784e214dd44eba39f4c34936a27e6cc82948205c (patch)
tree42ce7135e1045117461118f7cbc098df5e707138 /rts/Schedule.c
parent069cd16951bd45a55c94b5adce048c4ec9aad2c8 (diff)
downloadhaskell-784e214dd44eba39f4c34936a27e6cc82948205c.tar.gz
Annotate thread stop events with the owner of the black hole
So we can now get these in ThreadScope: 19487000: cap 1: stopping thread 6 (blocked on black hole owned by thread 4) Note: needs an update to ghc-events. Older ThreadScopes will just ignore the new information.
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 621aef2ab7..4343a149cc 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -484,7 +484,17 @@ run_thread:
t->saved_winerror = GetLastError();
#endif
- traceEventStopThread(cap, t, ret);
+ if (ret == ThreadBlocked) {
+ if (t->why_blocked == BlockedOnBlackHole) {
+ StgTSO *owner = blackHoleOwner(t->block_info.bh->bh);
+ traceEventStopThread(cap, t, t->why_blocked + 6,
+ owner != NULL ? owner->id : 0);
+ } else {
+ traceEventStopThread(cap, t, t->why_blocked + 6, 0);
+ }
+ } else {
+ traceEventStopThread(cap, t, ret, 0);
+ }
ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
ASSERT(t->cap == cap);
@@ -1724,7 +1734,7 @@ suspendThread (StgRegTable *reg, rtsBool interruptible)
task = cap->running_task;
tso = cap->r.rCurrentTSO;
- traceEventStopThread(cap, tso, THREAD_SUSPENDED_FOREIGN_CALL);
+ traceEventStopThread(cap, tso, THREAD_SUSPENDED_FOREIGN_CALL, 0);
// XXX this might not be necessary --SDM
tso->what_next = ThreadRunGHC;