instalar descargar como haskell cabal

descargar - haskell ghc download



¿Cómo perfilar bibliotecas? (2)

Supongo que es probable que haya una opción que coloque los centros de costos en un código de biblioteca externa

Bueno, no por defecto. Debe agregar los centros de costo cuando compila la dependencia. Sin embargo, puede agregar -fprof-auto a las opciones de ghc durante la cabal install ghc :

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

Ejemplo

Un ejemplo utilizando el código de esta pregunta , donde el código de la pregunta está contenido en 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 and 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

Desafortunadamente, no puede indicar --ghc-option=… como un indicador en las dependencias.

¿Hay alguna opción oculta que ponga los centros de costos en las bibliotecas? Actualmente he configurado mi perfil de esta manera:

cábala:

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

Esto funciona y crea el archivo .prof esperado, el archivo .hp y el resumen cuando finaliza el programa.

El problema es que el archivo .prof no contiene nada que no pertenezca al proyecto actual. Supongo que es probable que haya una opción que coloque los centros de costos en un código de biblioteca externa.


Usted también necesita -prof .

La Guía del usuario de GHC dice: "Hay algunas otras opciones de compilación relacionadas con la creación de perfiles. Utilícelas además de -prof . No es necesario que se utilicen de forma coherente para todos los módulos de un programa.

"