Ticket #680 (new bug)

Opened 3 years ago

Last modified 2 years ago

SCC mis-accounting

Reported by: andrew@pimlott.net Assigned to: simonmar
Priority: low Milestone: _|_
Component: Profiling Version: 6.4.1
Severity: normal Keywords:
Cc: Difficulty: Unknown
Test Case: Architecture: Unknown
Operating System: Unknown

Description

The profiles sometimes charges to the wrong account. In this example:

foo :: (() -> () -> [()] -> [()]) -> () -> [()] -> [()]
foo k =
  \_ xs -> concatMap ($ [head xs]) [bar]
 where
  bar =
    let k' = k undefined undefined
    in  \xs ->
          let k'' = [k' xs]
          in  (() : (foldr1 (>>) k''))

k = foo (\_ -> k)
--k a = foo (\_ -> k) a
r = k undefined [] !! 4000
main = print r

almost all of the time, allocations, and heap retention are charged to k. However, if you use the commented definition of k, the changes switch to foo, as expected. This can be tested by running

ghc --make -prof -auto-all Logic.hs && ./a.out +RTS -hc && hp2ps -c a.out.hp

and watching the pretty graph change.

This is using ghc 6.4.1 from Debian unstable. More background at http://haskell.org/pipermail/haskell-cafe/2006-February/014139.html

Change History

02/06/06 08:53:23 changed by simonpj

  • owner set to simonmar.

06/22/06 06:19:25 changed by simonmar

  • priority changed from normal to low.

01/18/07 01:27:05 changed by simonmar

  • testcase changed.
  • milestone set to _|_.