Permalink
Browse files

Enables convenient profiling with patched Dyre.

Note that one has to use compilation flags and patched Dyre with
rtsOptsHandling configuration parameter.

Compile with:
cabal install --enable-library-profiling    \
              --enable-executable-profiling \
              --flags=profiling

RTS options will be automatically forwarded from main binary by Dyre.
  • Loading branch information...
1 parent 755b585 commit 6d555d9b855b22aaf99d38918b85c29e1fc74140 Michal J. Gajda committed Jul 16, 2012
Showing with 22 additions and 1 deletion.
  1. +5 −1 yi/src/library/Yi/Boot.hs
  2. +17 −0 yi/yi.cabal
@@ -54,7 +54,11 @@ yiDriver cfg = do
, Dyre.showError = showErrorsInConf
, Dyre.configDir = Just . getAppUserDataDirectory $ "yi"
, Dyre.hidePackages = ["mtl"]
- , Dyre.ghcOpts = ["-threaded", "-O2"] ++ ghcOptions cfgcon
+ , Dyre.ghcOpts = (["-threaded", "-O2"] ++
+#ifdef PROFILING
+ ["-prof", "-auto-all", "-rtsopts"] ++
+#endif
+ ghcOptions cfgcon)
}
in Dyre.wrapMain yiParams (finalCfg, cfgcon)
View
@@ -54,6 +54,12 @@ flag ghcAPI
-- * links against old version of Cabal
-- ...
+flag profiling
+ Default: False
+ Description:
+ Runtime binary will be compiled with profiling and RTS
+ options enabled.
+
flag hacking
Default: False
Description:
@@ -79,6 +85,9 @@ library
if flag(hacking)
buildable: False
+ if flag(profiling)
+ CPP-options: -DPROFILING
+
exposed-modules:
Yi
Yi.Boot
@@ -232,6 +241,10 @@ library
build-tools: alex >= 3
ghc-options: -Wall -fno-warn-orphans
+ ghc-prof-options: -prof -auto-all -rtsopts
+ if flag(profiling)
+ cpp-options: -DPROFILING
+
if flag(hacking)
ghc-prof-options: -prof -auto-all
@@ -369,6 +382,9 @@ executable yi
if flag(dochack)
buildable: False
+
+ if flag(profiling)
+ cpp-options: -DPROFILING
if flag(hacking)
main-is: HackerMain.hs
@@ -381,3 +397,4 @@ executable yi
build-depends: yi
build-tools: alex >= 3
ghc-options: -threaded
+ ghc-prof-options: -prof -auto-all -rtsopts

0 comments on commit 6d555d9

Please sign in to comment.