gpt4 book ai didi

haskell - 如何解释 Haskell +RTS -s 摘要输出

转载 作者:行者123 更新时间:2023-12-05 04:03:41 27 4
gpt4 key购买 nike

我一直在对代码进行一些性能测试,并发现了 +RTS -s 标志,它显示了程序执行的一系列指标。但是我还没有找到关于如何解释输出的完整解释。

我找到了一些关于 spark 的资源,并解释了它们如何成为线程池的任务。

任务是什么意思?

如何使用INITMUT 等读取表格?

在这种情况下,Productivity 是什么意思?

10:23:12 decision-tree-haskell $ stack exec -- performance-test +RTS -A200M -N -s
4,952,803,088 bytes allocated in the heap
5,277,992 bytes copied during GC
1,438,264 bytes maximum residency (2 sample(s))
70,552 bytes maximum slop
816 MB total memory in use (0 MB lost due to fragmentation)

Tot time (elapsed) Avg pause Max pause
Gen 0 22 colls, 22 par 0.036s 0.011s 0.0005s 0.0058s
Gen 1 2 colls, 1 par 0.004s 0.001s 0.0006s 0.0010s

Parallel GC work balance: 8.43% (serial 0%, perfect 100%)

TASKS: 10 (1 bound, 9 peak workers (9 total), using -N4)

SPARKS: 48 (48 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

INIT time 0.009s ( 0.009s elapsed)
MUT time 9.846s ( 9.895s elapsed)
GC time 0.040s ( 0.013s elapsed)
EXIT time 0.001s ( 0.000s elapsed)
Total time 9.963s ( 9.916s elapsed)

Alloc rate 503,030,959 bytes per MUT second

Productivity 99.5% of total user, 99.8% of total elapsed

gc_alloc_block_sync: 808
whitehole_spin: 0
gen[0].sync: 9
gen[1].sync: 0

最佳答案

您看过 GHC 用户手册了吗?

https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#rts-options-to-produce-runtime-statistics

[...] Next there is the CPU time and wall clock time elapsed broken down by what the runtime system was doing at the time. INIT is the runtime system initialisation. MUT is the mutator time, i.e. the time spent actually running your code. GC is the time spent doing garbage collection. RP is the time spent doing retainer profiling. PROF is the time spent doing other profiling. EXIT is the runtime system shutdown time. And finally, Total is, of course, the total.

%GC time tells you what percentage GC is of Total. “Alloc rate” tells you the “bytes allocated in the heap” divided by the MUT CPU time. “Productivity” tells you what percentage of the Total CPU and wall clock elapsed times are spent in the mutator (MUT).

所以 INIT 是启动 GHC 运行时系统所用的时间,EXIT 是关闭它所用的时间,GC 是垃圾收集器运行的时间,MUT 是你的实际程序所用的时间 正在做有用的工作。

“已用”时间是实际挂钟时间,而第一个数字是 CPU 时间。 (例如,如果您有一个 4 核 CPU,则 CPU 时间可能比实际时间长很多。不确定等待 I/O 的时间是多少。)

出于某种原因,我似乎无法从手册中找到引述,但我相信“生产力”是运行代码所花费的时间百分比(与运行垃圾收集器、等待 I/O 相对)等)。

关于haskell - 如何解释 Haskell +RTS -s 摘要输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53478138/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com