Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 890
mb14 Avatar asked Nov 21 '15 19:11

mb14


1 Answers

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

like image 79
axm Avatar answered Oct 14 '22 16:10

axm