diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-03-17 16:42:14 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-03-17 16:42:14 +0000 |
commit | 8b18faef8aeaf40150c208272a2fc117611e8ae8 (patch) | |
tree | 2aabc6115dccd0a3e303320515564b5628c8771c /rts/Threads.c | |
parent | f8f4cb3f3a46e0495917a927cefe906531b7b38e (diff) | |
download | haskell-8b18faef8aeaf40150c208272a2fc117611e8ae8.tar.gz |
Add fast event logging
Generate binary log files from the RTS containing a log of runtime
events with timestamps. The log file can be visualised in various
ways, for investigating runtime behaviour and debugging performance
problems. See for example the forthcoming ThreadScope viewer.
New GHC option:
-eventlog (link-time option) Enables event logging.
+RTS -l (runtime option) Generates <prog>.eventlog with
the binary event information.
This replaces some of the tracing machinery we already had in the RTS:
e.g. +RTS -vg for GC tracing (we should do this using the new event
logging instead).
Event logging has almost no runtime cost when it isn't enabled, though
in the future we might add more fine-grained events and this might
change; hence having a link-time option and compiling a separate
version of the RTS for event logging. There's a small runtime cost
for enabling event-logging, for most programs it shouldn't make much
difference.
(Todo: docs)
Diffstat (limited to 'rts/Threads.c')
-rw-r--r-- | rts/Threads.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rts/Threads.c b/rts/Threads.c index 936b90e884..501c7514c7 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -210,6 +210,8 @@ createThread(Capability *cap, nat size) } #endif + postEvent (cap, EVENT_CREATE_THREAD, tso->id, 0); + #if defined(GRAN) debugTrace(GRAN_DEBUG_pri, "==__ schedule: Created TSO %d (%p);", @@ -503,6 +505,7 @@ unblockOne_ (Capability *cap, StgTSO *tso, ASSERT(tso->bound->cap == tso->cap); tso->bound->cap = cap; } + tso->cap = cap; appendToRunQueue(cap,tso); @@ -523,8 +526,9 @@ unblockOne_ (Capability *cap, StgTSO *tso, cap->context_switch = 1; #endif - debugTrace(DEBUG_sched, - "waking up thread %ld on cap %d", + postEvent (cap, EVENT_THREAD_WAKEUP, tso->id, tso->cap->no); + + debugTrace(DEBUG_sched, "waking up thread %ld on cap %d", (long)tso->id, tso->cap->no); return next; |