Incrementally consuming the eventlog

Johan Tibell johan.tibell at
Thu Apr 28 23:31:58 CEST 2011


We were discussing how to consume the eventlog incrementally on #ghc
today. Would it be feasible to offer an API (e.g. GHC.EventLog) that
allows programs to register for events that occur in the program?
Programs would register listeners like so:

   registerEventListener (\ event -> doSomethingWith event)

The current write-to-file system could be implemented in terms of this
API. We could even allow event logging to be turned on/off from within
the application, allowing developers to attach to a running
application, enable event logging, diagnose the app, and then turn of
event logging again.

The RTS would invoke listeners every time a new event is written. This
design has many benefits:

- We don't need to introduce the serialization, deserialization, and
I/O overhead of first writing the eventlog to file and then parsing it
- Programs could monitor themselves and provide debug output (e.g. via
some UI component).
- Users could write code that redirects the output elsewhere e.g. to a
socket for remote monitoring.

Would invoking a callback on each event add too big of an overhead?
How about invoking the callback once every time the event buffer is


More information about the Glasgow-haskell-users mailing list