[Haskell] getting at performance metainfo

John Meacham john at repetae.net
Wed May 26 17:24:49 EDT 2004

I was playing with modifying QuickCheck to automatically benchmark the
routines as well as testing them for validity and something I have
wanted for a while now is a way to get at performance numbers from
within a haskell program itself. something like

data RunStats = RunStats { 
        rsThunksCreated :: Integer, 
        rsMemAlloced :: Integer, 
        rsMemFreed :: Integer, 
        rsCpuCycles :: Integer,
        rsClockTime :: Integer,
        rsEvals :: Integer,
        rsAlreadyWHNF :: Bool

and a function
evaluateStats :: a -> IO (a,RunStats)

which evaluates a to WHNF and returns the statistics of all resources
used in doing so. Now, probably a lot of the info I gave above might not
be available depending on the specifics of the runtime system, but some
should be, perhays more if profiling is turned on when compiling. Any
idea if this is plausable to implement? I think it could be very useful
in 'real-world' programming and evaluating data structures and
algorithms programatically.


John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell mailing list