edwinb/Idris-dev — pull request #236 by fmap (2013-03-15 17:14:01+00:00)
Title: RTS stats, opts, some minor improvements.

Hi. Some changes in rts:
+ Basic options.
+ A bit more detailed statistics.
+ Detach heap in separated structure and add some heap checks. (Btw that's how I found previous bug)
+ A few cosmetic changes, some checks (malloc(..) == NULL in heap allocation for example), etc.

In general, I didn't modify any important places except then I add stats macros. Currently stats should work only for the _parent_ (or root) vm and it uses _clock()_, but I'll fix that all.

A tiny program:
``` haskell
module Main
import Prelude

main : IO ()
main = print (sum ([1..100000] ++ [1..10]))
```

Now we run it:

``` bash
$ ./sum +RTS -s -RTS
705082759

103,979,544 bytes allocated in the heap
46,372,072 bytes copied during GC
20,480,000 maximum heap size
2,657,077 chunks allocated in the heap
39 average chunk size

GC called 10 times

INIT time: 0.000s
MUT time: 0.280s
GC time: 0.170s
EXIT time: 0.000s
TOTAL time: 0.450s

%GC time: 37.78%

Alloc rate 371,355,514 bytes per MUT sec

Productivity 62.22%
```

A couple more options here: ```prg +RTS -? -RTS```