mb14
mb14

Reputation: 22616

Using stack for profiling

I'm trying to do some profiling using stack --enable-profiling and I'm a bit confused about what's happening exactly.

Do I need to use also --enable-library ?. Also, is it build in a separate directory ?What happend next I build it, will remember that am I in profiling mode or do I have to use the --enable-profiling all the time.

It is generally recommended to profile in conjonction with the -O2 option. Does --enable-profiling set it automatically ?

Upvotes: 6

Views: 981

Answers (1)

axm
axm

Reputation: 281

Stack support for enabling profiling works great, example:

stack build --profile --executable-profiling --library-profiling
stack exec -- example <your prog args> +RTS -p

Then see example.prof for the default output.

Update: the stack support pointed me to the right correct for exec, see https://github.com/commercialhaskell/stack/issues/1655

Upvotes: 5

Related Questions