How do I tell stack
to build my executable and all its dependencies with -prof
?
Simply adding it to ghc-options
in the
Assuming a project called project-name
, this is how I get a time and heap profile (with colors):
build-depends
section of project-name.cabal
stack build
project-name/app
compile the program with profiling enabled: stack ghc -- -prof -fprof-auto -rtsopts -O2 Main.hs
./Main +RTS -hc -p
. This will produce Main.hp
and Main.prof
stack exec -- hp2ps -c Main.hp && ps2pdf Main.ps
That's the heap profile from the PDF: