haskell - How to profile libraries? -


is there hidden option put cost centres in libraries? have set profiling this:

cabal:

ghc-prof-options:    -o2                                                                                                                                                                                                                                        -threaded                                                                                                                                                                                                                                  -fexcess-precision                                                                                                                                                                                                                         -fprof-auto                                                                                                                                                                                                                                                                                                                                                                                                                                          -rtsopts                                                                                                                                                                                                                                   "-with-rtsopts=-n -p -s -h -i0.1"         

exec:

# cabal sandbox init # cabal install --enable-library-profiling --enable-executable-profiling # cabal configure --enable-library-profiling --enable-executable-profiling # cabal run 

this works , creates expected .prof file, .hp file , summary when program finishes.

problem .prof file doesn't contain doesn't belong current project. guess there option put cost centers in external library code?

my guess there option put cost centers in external library code?

well, not per default. need add cost centers when compile dependency. however, can add -fprof-auto ghc options during cabal install:

 $ cabal sandbox init $ cabal install --ghc-option=-fprof-auto -p --enable-executable-profiling 

example

an example using code question, code question contained in so.hs:

 $ cabal sandbox init $ cabal install vector -p --ghc-options=-fprof-auto $ cabal exec -- ghc --make so.hs -prof -fprof-auto -o2 $ ./so /usr/share/dict/words +rts -s -p $ cat so.prof     tue dec  2 15:01 2014 time , allocation profiling report  (final)         test +rts -s -p -rts /usr/share/dict/words      total time  =        0.70 secs   (698 ticks @ 1000 us, 1 processor)     total alloc = 618,372,952 bytes  (excludes profiling overheads)  cost centre            module                        %time %alloc  lettercount            main                           40.3   24.3 lettercount.letters1   main                           13.2   18.2 basicunsafewrite       data.vector.primitive.mutable  10.0   12.1 basicunsafewrite       data.vector.unboxed.base        7.2    7.3 basicunsaferead        data.vector.primitive.mutable   5.4    4.9 >>=                    data.vector.fusion.util         5.0   13.4 basicunsafeindexm      data.vector.unboxed.base        4.9    0.0 basicunsafeindexm      data.vector.primitive           2.7    4.9 basicunsafeindexm      data.vector.unboxed.base        2.3    0.0 lettercount.letters1.\ main                            2.0    2.4 >>=                    data.vector.fusion.util         1.9    6.1 basicunsafewrite       data.vector.unboxed.base        1.7    0.0 lettercount.\          main                            1.3    2.4 readbytearray#         data.primitive.types            0.3    2.4 basicunsafenew         data.vector.primitive.mutable   0.0    1.2                                                                                  individual     inherited cost centre                 module                           no.     entries  %time %alloc   %time %alloc  main                        main                              72           0    0.0    0.0   100.0  100.0  main                       main                             145           0    0.1    0.2    99.9  100.0   main.counts               main                             148           1    0.0    0.0    99.3   99.6    lettercount              main                             149           1   40.3   24.3    99.3   99.6     basicunsafefreeze       data.vector.unboxed.base         257           1    0.0    0.0     0.0    0.0      primitive              control.monad.primitive          259           1    0.0    0.0     0.0    0.0      basicunsafefreeze      data.vector.primitive            258           1    0.0    0.0     0.0    0.0     lettercount.\           main                             256      938848    1.3    2.4     1.3    2.4     basicunsafewrite        data.vector.unboxed.base         252      938848    1.3    0.0     5.0    6.1      basicunsafewrite       data.vector.primitive.mutable    253      938848    3.7    6.1     3.7    6.1       writebytearray#       data.primitive.types             255      938848    0.0    0.0     0.0    0.0       primitive             control.monad.primitive          254      938848    0.0    0.0     0.0    0.0     basicunsaferead         data.vector.unboxed.base         248      938848    0.7    0.0     6.6    7.3      basicunsaferead        data.vector.primitive.mutable    249      938848    5.4    4.9     5.9    7.3       readbytearray#        data.primitive.types             251      938848    0.3    2.4     0.3    2.4       primitive             control.monad.primitive          250      938848    0.1    0.0     0.1    0.0     >>=                     data.vector.fusion.util          243      938848    0.0    0.0     0.0    0.0     basicunsafeindexm       data.vector.unboxed.base         242      938848    0.0    0.0     0.0    0.0     basicunsafeindexm       data.vector.unboxed.base         237      938848    4.9    0.0    11.7   10.9      >>=                    data.vector.fusion.util          247      938848    1.9    6.1     1.9    6.1      basicunsafeindexm      data.vector.unboxed.base         238      938848    2.3    0.0     5.0    4.9       basicunsafeindexm     data.vector.primitive            239      938848    2.7    4.9     2.7    4.9        indexbytearray#      data.primitive.types             240      938848    0.0    0.0     0.0    0.0     >>=                     data.vector.fusion.util          236      938849    3.4    7.3     3.4    7.3     unid                    data.vector.fusion.util          235      938849    0.0    0.0     0.0    0.0     basiclength             data.vector.unboxed.base         234           1    0.0    0.0     0.0    0.0     basiclength             data.vector.primitive.mutable    233           1    0.0    0.0     0.0    0.0     basicunsafecopy         data.vector.unboxed.base         222           1    0.0    0.0     0.0    0.0      basicunsafecopy        data.vector.primitive            223           1    0.0    0.0     0.0    0.0       uni#                  data.primitive.bytearray         226           3    0.0    0.0     0.0    0.0     basiclength             data.vector.unboxed.base         214           1    0.0    0.0     0.0    0.0      basiclength            data.vector.primitive            215           1    0.0    0.0     0.0    0.0     basicunsafenew          data.vector.unboxed.base         212           1    0.0    0.0     0.0    0.0      primitive              control.monad.primitive          220           1    0.0    0.0     0.0    0.0      basicunsafenew         data.vector.primitive.mutable    216           1    0.0    0.0     0.0    0.0       sizeof                data.primitive                   217           1    0.0    0.0     0.0    0.0        sizeof#              data.primitive.types             218           1    0.0    0.0     0.0    0.0         uni#                data.primitive.types             219           1    0.0    0.0     0.0    0.0     basiclength             data.vector.unboxed.base         211           1    0.0    0.0     0.0    0.0     lettercount.len         main                             178           1    0.0    0.0     0.0    0.0     lettercount.letters1    main                             177           1   13.2   18.2    30.9   41.3      basicunsafefreeze      data.vector.unboxed.base         204           1    0.0    0.0     0.0    0.0       basicunsafefreeze     data.vector.unboxed.base         210           1    0.0    0.0     0.0    0.0       primitive             control.monad.primitive          207           1    0.0    0.0     0.0    0.0       basicunsafefreeze     data.vector.primitive            206           1    0.0    0.0     0.0    0.0       basicunsafefreeze     data.vector.unboxed.base         205           1    0.0    0.0     0.0    0.0        basicunsafefreeze    data.vector.primitive            208           0    0.0    0.0     0.0    0.0      basicunsafeslice       data.vector.unboxed.base         200           1    0.0    0.0     0.0    0.0       basicunsafeslice      data.vector.unboxed.base         203           1    0.0    0.0     0.0    0.0       basicunsafeslice      data.vector.unboxed.base         201           1    0.0    0.0     0.0    0.0        basicunsafeslice     data.vector.primitive.mutable    202           1    0.0    0.0     0.0    0.0      basicunsafewrite       data.vector.unboxed.base         193      938848    7.2    7.3    14.2   13.4       basicunsafewrite      data.vector.unboxed.base         198      938848    0.0    0.0     0.0    0.0       basicunsafewrite      data.vector.unboxed.base         194      938848    0.4    0.0     7.0    6.1        basicunsafewrite     data.vector.primitive.mutable    195      938848    6.3    6.1     6.6    6.1         writebytearray#     data.primitive.types             197      938848    0.3    0.0     0.3    0.0         primitive           control.monad.primitive          196      938848    0.0    0.0     0.0    0.0      lettercount.letters1.\ main                             192      938848    2.0    2.4     2.0    2.4      >>=                    data.vector.fusion.util          191      938848    1.6    6.1     1.6    6.1      unid                   data.vector.fusion.util          190      938849    0.0    0.0     0.0    0.0      upperbound             data.vector.fusion.stream.size   180           1    0.0    0.0     0.0    0.0      basicunsafenew         data.vector.unboxed.base         179           1    0.0    0.0     0.0    1.2       basicunsafenew        data.vector.unboxed.base         189           1    0.0    0.0     0.0    0.0       primitive             control.monad.primitive          187           1    0.0    0.0     0.0    0.0       basicunsafenew        data.vector.primitive.mutable    182           1    0.0    0.0     0.0    0.0       basicunsafenew        data.vector.unboxed.base         181           1    0.0    0.0     0.0    1.2        basicunsafenew       data.vector.primitive.mutable    183           0    0.0    1.2     0.0    1.2         sizeof              data.primitive                   184           1    0.0    0.0     0.0    0.0          sizeof#            data.primitive.types             185           1    0.0    0.0     0.0    0.0           uni#              data.primitive.types             186           1    0.0    0.0     0.0    0.0   printcounts               main                             146           1    0.4    0.2     0.4    0.2    basicunsafeindexm        data.vector.unboxed.base         266         256    0.0    0.0     0.0    0.0     basicunsafeindexm       data.vector.primitive            267           0    0.0    0.0     0.0    0.0      indexbytearray#        data.primitive.types             268         256    0.0    0.0     0.0    0.0    basicunsafeindexm        data.vector.primitive            265         256    0.0    0.0     0.0    0.0    >>=                      data.vector.fusion.util          264         256    0.0    0.0     0.0    0.0    unid                     data.vector.fusion.util          263         256    0.0    0.0     0.0    0.0    basiclength              data.vector.unboxed.base         262           1    0.0    0.0     0.0    0.0    basiclength              data.vector.primitive            261           1    0.0    0.0     0.0    0.0  caf                        main                             143           0    0.0    0.0     0.0    0.0   main                      main                             144           1    0.0    0.0     0.0    0.0    main.counts              main                             150           0    0.0    0.0     0.0    0.0     lettercount             main                             151           0    0.0    0.0     0.0    0.0      basicunsafeindexm      data.vector.unboxed.base         244           0    0.0    0.0     0.0    0.0       >>=                   data.vector.fusion.util          245           0    0.0    0.0     0.0    0.0        basicunsafeindexm    data.vector.unboxed.base         246           0    0.0    0.0     0.0    0.0      primitive              control.monad.primitive          224           1    0.0    0.0     0.0    0.0      basicunsafefreeze      data.vector.unboxed.base         173           1    0.0    0.0     0.0    0.0       primitive             control.monad.primitive          175           1    0.0    0.0     0.0    0.0       basicunsafefreeze     data.vector.primitive            174           1    0.0    0.0     0.0    0.0      basicunsafeslice       data.vector.unboxed.base         171           1    0.0    0.0     0.0    0.0       basicunsafeslice      data.vector.primitive.mutable    172           1    0.0    0.0     0.0    0.0      basicunsafewrite       data.vector.unboxed.base         167         256    0.0    0.0     0.0    0.0       basicunsafewrite      data.vector.primitive.mutable    168         256    0.0    0.0     0.0    0.0        writebytearray#      data.primitive.types             170         256    0.0    0.0     0.0    0.0        primitive            control.monad.primitive          169         256    0.0    0.0     0.0    0.0      >>=                    data.vector.fusion.util          165         256    0.0    0.0     0.0    0.0      unid                   data.vector.fusion.util          164         257    0.0    0.0     0.0    0.0      basicunsafenew         data.vector.unboxed.base         156           1    0.0    0.0     0.0    0.0       primitive             control.monad.primitive          162           1    0.0    0.0     0.0    0.0       basicunsafenew        data.vector.primitive.mutable    157           1    0.0    0.0     0.0    0.0        sizeof               data.primitive                   158           1    0.0    0.0     0.0    0.0         sizeof#             data.primitive.types             159           1    0.0    0.0     0.0    0.0          uni#               data.primitive.types             160           1    0.0    0.0     0.0    0.0      upperbound             data.vector.fusion.stream.size   153           1    0.0    0.0     0.0    0.0      elemseq                data.vector.unboxed.base         152           1    0.0    0.0     0.0    0.0    printcounts              main                             147           0    0.0    0.0     0.0    0.0  caf                        data.vector.internal.check       142           0    0.0    0.0     0.0    0.0   doboundschecks            data.vector.internal.check       213           1    0.0    0.0     0.0    0.0   dounsafechecks            data.vector.internal.check       155           1    0.0    0.0     0.0    0.0   dointernalchecks          data.vector.internal.check       154           1    0.0    0.0     0.0    0.0  caf                        data.vector.fusion.util          141           0    0.0    0.0     0.0    0.0   return                    data.vector.fusion.util          241           1    0.0    0.0     0.0    0.0   return                    data.vector.fusion.util          166           1    0.0    0.0     0.0    0.0  caf                        data.vector.unboxed.base         136           0    0.0    0.0     0.0    0.0   basicunsafecopy           data.vector.unboxed.base         227           0    0.0    0.0     0.0    0.0    basicunsafecopy          data.vector.primitive            228           0    0.0    0.0     0.0    0.0     basicunsafecopy.sz      data.vector.primitive            229           1    0.0    0.0     0.0    0.0      sizeof                 data.primitive                   230           1    0.0    0.0     0.0    0.0       sizeof#               data.primitive.types             231           1    0.0    0.0     0.0    0.0        uni#                 data.primitive.types             232           1    0.0    0.0     0.0    0.0  caf                        data.primitive.machdeps          128           0    0.0    0.0     0.0    0.0   sizeof_int                data.primitive.machdeps          161           1    0.0    0.0     0.0    0.0  caf                        text.printf                      118           0    0.0    0.0     0.0    0.0  caf                        ghc.conc.signal                  112           0    0.0    0.0     0.0    0.0  caf                        ghc.io.handle.fd                 109           0    0.1    0.0     0.1    0.0  caf                        ghc.io.encoding                   99           0    0.0    0.0     0.0    0.0  caf                        ghc.io.encoding.iconv             98           0    0.0    0.0     0.0    0.0  caf                        ghc.io.fd                         95           0    0.0    0.0     0.0    0.0 

unfortunately, cannot state --ghc-option=… flag @ dependencies.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -