我正试图介绍我的程序。我用
编译了它stack build --executable-profiling --library-profiling --ghc-options=" -fprof-auto -rtsopts=all -caf-all"
运行程序时,运行时统计信息中存在很大差异:
./example +RTS -s -sstderr
68,183,336 bytes allocated in the heap
7,520,984 bytes copied during GC
573,296 bytes maximum residency (5 sample(s))
34,728 bytes maximum slop
3 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 127 colls, 0 par 0.020s 0.007s 0.0001s 0.0004s
Gen 1 5 colls, 0 par 0.000s 0.002s 0.0005s 0.0007s
TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.000s ( 0.002s elapsed)
MUT time 0.012s ( 0.026s elapsed)
GC time 0.020s ( 0.010s elapsed)
RP time 0.000s ( 0.000s elapsed)
PROF time 0.000s ( 0.000s elapsed)
EXIT time 0.000s ( 0.000s elapsed)
Total time 0.032s ( 0.038s elapsed)
Alloc rate 5,681,944,666 bytes per MUT second
Productivity 37.5% of total user, 31.8% of total elapsed
gc_alloc_block_sync: 0
whitehole_spin: 0
gen[0].sync: 0
gen[1].sync: 0
接下来的运行给出了:
$ ./example +RTS -s -sstderr
68,183,336 bytes allocated in the heap
7,520,984 bytes copied during GC
573,296 bytes maximum residency (5 sample(s))
34,728 bytes maximum slop
3 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 127 colls, 0 par 0.000s 0.007s 0.0001s 0.0002s
Gen 1 5 colls, 0 par 0.004s 0.002s 0.0004s 0.0006s
TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.000s ( 0.002s elapsed)
MUT time 0.024s ( 0.025s elapsed)
GC time 0.004s ( 0.009s elapsed)
RP time 0.000s ( 0.000s elapsed)
PROF time 0.000s ( 0.000s elapsed)
EXIT time 0.000s ( 0.000s elapsed)
Total time 0.028s ( 0.036s elapsed)
Alloc rate 2,840,972,333 bytes per MUT second
Productivity 85.7% of total user, 67.5% of total elapsed
gc_alloc_block_sync: 0
whitehole_spin: 0
gen[0].sync: 0
gen[1].sync: 0
该程序的调用方式完全相同(当然没有重新编译);然而Productivity
从38%变为85%以上,其他值也完全不同。 此外,字段 ...我做错了什么?GC time
和total memory use
缺失
非常感谢提前!