Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

threadscope functionality

Can programs be monitored while they are running (possibly piping the event log)? Or is it only possible to view event logs after execution. If the latter is the case, is there a deeper reason with respect to how the Haskell runtime works?

Edit: I don't know much about the runtime tbh, but given dflemstr's response, I was curious about how much and the ways in which performance is degraded by adding the event monitoring runtime option. I recall in RWH they mentioned that the rts has to add cost centres, but I wasn't completely sure about how expensive this sort of thing was.

like image 734
Anil Vaitla Avatar asked Nov 05 '22 06:11

Anil Vaitla


2 Answers

The direct answer is that, no, it is not possible. And, no, there is no reason for that except that nobody has done the required legwork so far.

I think this would mainly be a matter of

  1. Modifying ghc-events so it supports reading event logs chunk-wise and provide partial results. Maybe porting it over to attoparsec would help?

  2. Threadscope would have to update its internal tree data structures as new data streams in.

Nothing too hard, but somebody would need to do it. I think I heard discussion about adding this feature already... So it might happen eventually.

Edit: And to make it clear, there's no real reason this would have to degrade performance beyond what you get with event log or cost centre profiling already.

like image 157
Peter Wortmann Avatar answered Nov 10 '22 03:11

Peter Wortmann


If you want to monitor the performance of the application while it is running, you can for instance use the ekg package as described in this blog post. It isn't as detailed as ThreadScope, but it does the job for web services, for example.

To get live information about what the runtime is doing, you can use the dtrace program to capture dynamic events posted by some GHC runtime probes. How this is done is outlined in this wiki page. You can then use this information to put together a more coherent event log.

like image 24
dflemstr Avatar answered Nov 10 '22 05:11

dflemstr