Reputation: 456
I am currently trying to profile a Haskell server. The server runs forever, so I just want a profiling report for a fixed amount of time. I tried just running the program for 3 minutes, and then politely ask it to terminate, but somehow the haskell profiler doesn't obey the term signal, and generates incomplete data.
My first attempt:
timeout --signal SIGTERM 3m ./actionsDemo +RTC -hc -RTS -p -K100M
Anyone any idea how to neatly profile this server?
Upvotes: 11
Views: 251
Reputation: 2615
You can try setting the timeout inside the Haskell code instead, e.g. by wrapping everything in the System.Timeout.timeout
function. That way the runtime should have a better chance to respond and give a proper profile.
import System.Timeout (timeout)
main = timeout (3*60*1000000) $ do
...
Upvotes: 0
Reputation: 21811
The methods for getting a heap profile of a running program are well documented here, section 5.5.3. In short, you just need to remove the last "incomplete" sample, and then proceed as usual.
There's also a relevant trac ticket to make hp2ps handle this on its own, but it doesn't seem to be ready yet.
For time/allocation profiling, I don't have an answer.
Upvotes: 2