Dear GHC  (pre-4.07-i386-unknown-linux),

I am going to use the profiling to measure the parts of certain 
large program. To understand things, I start with simple example:

  main =
    let  lgft :: Integer -> Int
         lgft n = _scc_ "length n!" (length $ show $ product [2..n])

         ls = map lgft [2..500] :: [Int]
         s  = _scc_ "sum" (sum [1..22000] :: Integer)
    in
    putStr $ shows (s,ls) "\n"
  ---------------------------------------------

  ghc -c -O -prof T.hs;  ghc -o -prof run T.o;   run +RTS -pT
gives  run.prof:
---------------------------------------------------
        total time  =        3.60 secs   (180 ticks @ 20 ms)
        total alloc = 139,166,388 bytes  (excludes profiling overheads)

COST CENTRE          MODULE     %time %alloc

length n!            Main        99.4   99.3
GC                   GC          24.4    0.0

                                              individual     inherited
COST CENTRE              MODULE     entries  %time %alloc   %time %alloc

MAIN                     MAIN             0    0.0   0.0    100.0 100.0
 CAF                     PrelHandle       3    0.0   0.0      0.0   0.0
 CAF                     Main             3    0.0   0.0    100.0 100.0
  length n!              Main           499   99.4  99.3     99.4  99.3
  sum                    Main             1    0.6   0.7      0.6   0.7
-----------------------------------------------------------------

What does this mean CAF ?

The last two lines of the second table show that  0.994  of time and  
0.993  of allocations was spent by the center "length n!".
This looks natural.

But what means the first table? Why "sum" is skipped there?
Does it show that the Garbage Collection has taken  0.244  of the 
total time?
GC can be caused by many values. To find out which part of GC is 
caused by the given item  f,  we have to look at the  %alloc  part for
f  in the second table.

Could you please tell me whether I understand these things correct?

Thank you.

------------------
Sergey Mechveliani
[EMAIL PROTECTED] 











Reply via email to