Haskell WinGHC 运行程序与性能统计

问题描述 投票:0回答:1

使用 WinGHC,我如何使用 +RTS -sstderr 选项运行我的程序来获取编译时间、内存使用情况或其他感兴趣的统计信息?

目前我正在使用命令行:ghc -rtsopts -O3 -prof -auto-all Main.hs

haskell winghci
1个回答
0
投票

使用 WinGHCi 设置程序所在的活动目录

 Prelude> :cd C:\Haskell

然后,当您按照上面之前的评论进入正确的目录时,输入:

Prelude> :! ghc +RTS -s -RTS -O2 -prof -fprof-auto Main.hs

“Main.hs”应该是您的程序名称。

这将给出如下统计数据:

 152,495,848 bytes allocated in the heap
  36,973,728 bytes copied during GC
  10,458,664 bytes maximum residency (5 sample(s))
   1,213,516 bytes maximum slop
          21 MB total memory in use (0 MB lost due to fragmentation)

                                Tot time (elapsed)  Avg pause  Max pause
 Gen  0       241 colls,     0 par    0.14s    0.20s     0.0008s    0.0202s
 Gen  1         5 colls,     0 par    0.08s    0.12s     0.0233s    0.0435s
 etc..........
 etc.............

可以设置其他标志来查看其他统计数据。

© www.soinside.com 2019 - 2024. All rights reserved.