velveteer / ghc-eventlog-socket

Pipe the GHC eventlog stream to a UNIX domain socket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eventlog-socket

Link against this library to send GHC's eventlog stream to a Unix domain socket.

For instance,

$ ghc -package eventlog-socket -eventlog MyProgram.hs
$ GHC_EVENTLOG_SOCKET=/tmp/my-program.eventlog.sock ./MyProgram +RTS -l &
$ nc -U /tmp/my-program.eventlog.sock > my-program.eventlog

Note that this will during program start-up to wait for a consumer to connect to the socket.

This is a prototype to play around with the possibility of using the eventlog for realtime profiling and performance analysis. There are still numerous open questions:

  • access control?
  • support only Unix domain sockets or also tcp/ip?
  • do we want to support multiple consumers?
  • should we block program startup to wait for a consumer to connect?
  • if not, how do we make sure that the consumer is sent the eventlog header?
  • what should happen when a consumer disconnects? we could either
    • close the socket and stop streaming
    • just pause the eventlog until a new consumer shows up
    • pause the program until a new consumer shows up
    • kill the program

About

Pipe the GHC eventlog stream to a UNIX domain socket

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C 80.0%Language:Haskell 20.0%