diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2009-12-12 10:08:09 +0000 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2009-12-12 10:08:09 +0000 |
commit | 015d3d46b6de2f95386a515a7d166d996a0416db (patch) | |
tree | da6c07854ca7ac899f08d56e5185ba55b6b854ac /rts/RtsProbes.d | |
parent | dcba7784a1af5fd0c054031c49fe159d69af4f86 (diff) | |
download | haskell-015d3d46b6de2f95386a515a7d166d996a0416db.tar.gz |
Expose all EventLog events as DTrace probes
- Defines a DTrace provider, called 'HaskellEvent', that provides a probe
for every event of the eventlog framework.
- In contrast to the original eventlog, the DTrace probes are available in
all flavours of the runtime system (DTrace probes have virtually no
overhead if not enabled); when -DTRACING is defined both the regular
event log as well as DTrace probes can be used.
- Currently, Mac OS X only. User-space DTrace probes are implemented
differently on Mac OS X than in the original DTrace implementation.
Nevertheless, it shouldn't be too hard to enable these probes on other
platforms, too.
- Documentation is at http://hackage.haskell.org/trac/ghc/wiki/DTrace
Diffstat (limited to 'rts/RtsProbes.d')
-rw-r--r-- | rts/RtsProbes.d | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/rts/RtsProbes.d b/rts/RtsProbes.d new file mode 100644 index 0000000000..87a34c8dca --- /dev/null +++ b/rts/RtsProbes.d @@ -0,0 +1,62 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The GHC Team, 2009 + * + * User-space dtrace probes for the runtime system. + * + * ---------------------------------------------------------------------------*/ + +#include "HsFFI.h" +#include "rts/EventLogFormat.h" + + +// ----------------------------------------------------------------------------- +// Payload datatypes for Haskell events +// ----------------------------------------------------------------------------- + +// We effectively have: +// +// typedef uint16_t EventTypeNum; +// typedef uint64_t EventTimestamp; // in nanoseconds +// typedef uint32_t EventThreadID; +// typedef uint16_t EventCapNo; +// typedef uint16_t EventPayloadSize; // variable-size events +// typedef uint16_t EventThreadStatus; + + +// ----------------------------------------------------------------------------- +// The HaskellEvent provider captures everything from eventlog for use with +// dtrace +// ----------------------------------------------------------------------------- + +// These probes correspond to the events defined in EventLogFormat.h +// +provider HaskellEvent { + + // scheduler events + probe create__thread (EventCapNo, EventThreadID); + probe run__thread (EventCapNo, EventThreadID); + probe stop__thread (EventCapNo, EventThreadID, EventThreadStatus); + probe thread__runnable (EventCapNo, EventThreadID); + probe migrate__thread (EventCapNo, EventThreadID, EventCapNo); + probe run__spark (EventCapNo, EventThreadID); + probe steal__spark (EventCapNo, EventThreadID, EventCapNo); + probe shutdown (EventCapNo); + probe thread_wakeup (EventCapNo, EventThreadID, EventCapNo); + probe gc__start (EventCapNo); + probe gc__end (EventCapNo); + probe request__seq__gc (EventCapNo); + probe request__par__gc (EventCapNo); + probe create__spark__thread (EventCapNo, EventThreadID); + + // other events +//This one doesn't seem to be used at all at the moment: +// probe log__msg (char *); + probe startup (EventCapNo); + // we don't need EVENT_BLOCK_MARKER with dtrace + probe user__msg (EventCapNo, char *); + probe gc__idle (EventCapNo); + probe gc__work (EventCapNo); + probe gc__done (EventCapNo); + +}; |