Profiling binary consumes CPU even when idle on Linux.
The program is
import Control.Concurrent
import Control.Monad (forever)
main :: IO ()
main = forever $ threadDelay 1000000 >> return ()
Compiled with 32bit GHC 7.6.3 or 7.8.2 on Debian (inside a VM), GHC 7.4.1 on Ubuntu (not VM).
The non-profiling binary doesn't consume CPU, the profiling does ~10% (of a 2Ghz machine). Running with +RTS -I0
, so this is not the idle gc.
When strace-ing, the profiling one seems to receive a constant flow of SIGVTALRM, while the normal receives one burst each second.
I see I can switch off "master tick interval" with -V0
, and then CPU is not used, but the consequences of this are not very well documented (apart from context switching becoming deterministic).
Interestingly, if I compile using profiling on Windows (latest haskell-platform, 64-bit), it doesn't use more CPU than the non-profiling.
So, the question is, why does this happen on Linux, and if it can be avoided somehow.