|
|
|
# Live profiling via RTS and ghc-events project
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
|
|
|
|
Some guideline goals as, set out by [ Duncan Coutts](http://www.well-typed.com/people/duncan):
|
|
|
|
|
|
|
|
|
|
|
|
In the RTS:
|
|
|
|
|
|
|
|
- Allow turning event logging on/off as a whole at runtime.
|
|
|
|
- Allow turning on/off individual classes of events at runtime.
|
|
|
|
- Allow redirecting the eventlog output from a file to an arbitrary FD. (Interesting policy Q: what to do when sending out the eventlog blocks...)
|
|
|
|
- Allow emitting "synchronisation" events, mainly to be used when switching eventlog on/off or redirecting the output to a new sink, or just from time to time to let monitoring apps get a full tracking state. The synchronisation events would be basically the same ones as are emitted at startup, including process info, declaration of capsets, threads etc. (May require new events to distinguish the new "I'm reminding you that this thread exists" from the existing events like "I'm now creating this new thread". Or we may be able to have a semantics where a second "I'm creating thread 42" event is treated as a sync event and can be ignored.)
|
|
|
|
- Allow active flushing of the eventlog buffers. Normally the eventlog data is only flushed when a per-cap buffer is full. This can be a long time if one cap is very active while another is not. Software being monitored may wish to ensure that the latest data is sent out every few sec, even if the buffers are not full.
|
|
|
|
- Alternatively to the above, or as well, allow setting the per-cap eventlog buffer size.
|
|
|
|
- Haskell APIs for all the RTS features above.
|
|
|
|
|
|
|
|
|
|
|
|
In ghc-events library:
|
|
|
|
|
|
|
|
- redo the binary parser to be incremental both on input and output: that is allow supplying input chunk by chunk, and getting parsed events out for the data already supplied. This should be doable using the current version of the binary library.
|
|
|
|
|
|
|
|
|
|
|
|
Basic demo of live monitoring using above new features:
|
|
|
|
|
|
|
|
- demo CLI 'monitored' prog that uses the RTS APIs to direct its eventlog to a local FIFO, emit the various sync events. Perhaps interactive to exercise turning the eventlog on/off, enabling/disabling various event classes.
|
|
|
|
- demo CLI 'monitoring' prog that uses the new ghc-events lib to start reading and decoding the event stream.
|
|
|
|
- Proof-of-concept EKG-like functionality would be to emit mem/GC summary stats lines every second. |