Part of -ddump-timings doesn't -ddump-to-file
Given any Haskell file, e.g. Main.hs
such as
module Main (main) where
main :: IO ()
main = putStrLn $ "Hello " ++ "World!"
Some output of -ddump-timings
is printed to the console:
% ghc -ddump-to-file -ddump-timings Main.hs
*** Chasing dependencies:
Chasing dependencies: alloc=273264 time=0.356
[1 of 1] Compiling Main ( Main.hs, Main.o )
*** Parser [Main]:
*** Renamer/typechecker [Main]:
*** Desugar [Main]:
*** Simplifier [Main]:
*** CoreTidy [Main]:
*** CorePrep [Main]:
*** CodeGen [Main]:
Linking Main ...
while the rest is correctly redirected to the file:
% cat Main.dump-timings
Parser [Main]: alloc=112568 time=0.087
Renamer/typechecker [Main]: alloc=15670792 time=41.279
Desugar [Main]: alloc=138992 time=0.225
Simplifier [Main]: alloc=160504 time=0.214
CoreTidy [Main]: alloc=1866272 time=1.556
CorePrep [Main]: alloc=5088 time=0.010
CodeGen [Main]: alloc=1903240 time=2.033
Note the
*** Chasing dependencies:
Chasing dependencies: alloc=273264 time=0.356
which doesn't belong to any module. I'd expect that dumped to own file.
-dshow-passes
behaves similarly:
% ghc-9.2.0.20210821 -ddump-to-file -dshow-passes Main.hs
Glasgow Haskell Compiler, Version 9.2.0.20210821, stage 2 booted by GHC version 8.10.4
*** initializing unit database:
Using binary package database: /opt/ghc/9.2.0.20210821/lib/ghc-9.2.0.20210821/package.conf.d/package.cache
package flags []
loading package database /opt/ghc/9.2.0.20210821/lib/ghc-9.2.0.20210821/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.8.0
wired-in package ghc-bignum mapped to ghc-bignum-1.2
wired-in package base mapped to base-4.16.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.18.0.0
wired-in package ghc mapped to ghc-9.2.0.20210821
!!! initializing unit database: finished in 9.49 milliseconds, allocated 6.197 megabytes
*** initializing unit database:
package flags []
loading package database /opt/ghc/9.2.0.20210821/lib/ghc-9.2.0.20210821/package.conf.d
...
Except it doesn't even create any Main.show-passes
.
This makes debugging GHC performance on bigger projects imposssible.
I tested with GHC-8.6.5 and GHC-9.2-rc1, I suspect everything in between is affected as well.