【发布时间】:2023-04-09 16:28:02
【问题描述】:
我正在尝试分析一个具有一些依赖项的程序 Windingnumber。根据 Aleksander Dmitrov 在Profile Haskell without installing installing profiling libraries for all dependencies 中的回答,我正在使用 cabal-dev 来(尝试)构建所有启用了分析的依赖项。我试过了
-
cabal-dev install --config=./cabal-dev.config,其中 cabal-dev.config 是library-profiling: True executable-profiling: True package-db: /home/christopher/school/senior/senior_thesis/windingnumber_integration/cabal-dev/packages-7.6.1.conf local-repo: /home/christopher/school/senior/senior_thesis/windingnumber_integration/cabal-dev/packages user-install: False remote-repo: hackage.haskell.org:http://hackage.haskell.org/packages/archive remote-repo-cache: /home/christopher/.cabal/packages optimization: True build-summary: /home/christopher/school/senior/senior_thesis/windingnumber_integration/cabal-dev/logs/build.log remote-build-reporting: anonymous optimization: True install-dirs user prefix: /home/christopher/school/senior/senior_thesis/windingnumber_integration/cabal-dev/ install-dirs global cabal-dev install --cabal-install-arg='--enable-library-profiling' --cabal-install-arg='--enable-executable-profiling'
(当然,要从原始环境开始,在两者之间加上rm -rf cabal-dev。)在每种情况下,我都得到:
arch% cabal-dev/bin/windingnumber +RTS -p
cabal-dev/bin/windingnumber +RTS -p
windingnumber: the flag -p requires the program to be built with -prof
windingnumber:
windingnumber: Usage: <prog> <args> [+RTS <rtsopts> | -RTS <args>] ... --RTS <args>
<snip>
---即未启用分析。如何启用它?
ETA 解决方案: 将-prof 添加到项目的 .cabal 文件中的 ghc-options 中。显然在 cabal-dev 配置中设置 `executable-profiling: True" 并没有这样做。感谢 Daniel Fischer。
【问题讨论】:
-
看起来您没有使用
-prof标志构建可执行文件。你是如何构建windingnumber的? -
啊哈。在我的 .cabal 文件中将 -prof 添加到 ghc-options 修复了一些问题。谢谢!
-
您可能需要比默认更细粒度的分析,所以
-fprof-auto可能是一个不错的补充。 -
是的。这确实更有用。
-
不会这样调用 cabal-dev:
cabal-dev install --enable-library-profiling --enable-executable-profiling也可以吗?如果你想摆脱配置文件。