Improve accuracy of get/setAllocationCounter
[ghc.git] / testsuite / tests / rts / alloccounter1.hs
1 module Main where
2
3 import Control.Exception
4 import Control.Monad
5 import Data.List
6 import System.Mem
7
8 main = do
9 let
10 testAlloc n = do
11 let start = 999999
12 setAllocationCounter start
13 evaluate (last [1..n])
14 c <- getAllocationCounter
15 -- print (start - c)
16 return (start - c)
17 results <- forM [1..1000] testAlloc
18 print (sort results == results)
19 -- results better be in ascending order