使用堆栈进行分析

mb1*_*b14 6 haskell haskell-stack

我正在尝试使用进行一些分析stack --enable-profiling,但我对究竟发生了什么感到有些困惑。

我还需要使用--enable-library吗?。另外,它是否在单独的目录中构建?接下来我构建它会发生什么,会记住我是处于分析模式还是必须一直使用--enable-profiling

通常建议结合-O2选项进行分析。是否--enable-profiling自动设置?

axm*_*axm 5

启用分析的堆栈支持效果很好,例如:

stack build --profile --executable-profiling --library-profiling
stack exec -- example <your prog args> +RTS -p
Run Code Online (Sandbox Code Playgroud)

然后查看 example.prof 获取默认输出。

更新:堆栈支持为我指出了正确的 exec,请参阅https://github.com/commercialhaskell/stack/issues/1655