Dan*_*iel 7 garbage-collection haskell tamarin-prover
我正在使用一个用 Haskell 编码的程序+RTS -N3 -M9G -s -RTS,我传递给它是为了在执行结束时获取运行时统计信息。我偶尔会得到生产力为负的结果。此外,程序成功运行其任务,但 MUT 为零。
3,904,320,026,552 bytes allocated in the heap\n4,110,237,505,912 bytes copied during GC\n 6,874,676,192 bytes maximum residency (706 sample(s))\n 16,352,288 bytes maximum slop\n 9369 MiB total memory in use (0 MB lost due to fragmentation)\n\n Tot time (elapsed) Avg pause Max pause\n Gen 0 2402028 colls, 987034 par 39844.808s 1005.947s 0.0004s 0.0150s\n Gen 1 706 colls, 583 par 1165.131s 1730.422s 2.4510s 17.6798s\n\n Parallel GC work balance: 70.86% (serial 0%, perfect 100%)\n\n TASKS: 8 (1 bound, 7 peak workers (7 total), using -N3)\n\n SPARKS: 36096 (16594 converted, 0 overflowed, 0 dud, 5857 GC\'d, 13645 fizzled)\n\n INIT time 0.003s ( 0.002s elapsed)\n MUT time 0.000s (789.778s elapsed)\n GC time 41009.939s (2736.369s elapsed)\n EXIT time 2.253s ( 0.001s elapsed)\n Total time 5072.554s (3526.151s elapsed)\n\n Alloc rate 0 bytes per MUT second\n\n Productivity -708.5% of total user, 22.4% of total elapsed\n\n\nreal 58m46,534s\nuser 80m23,692s\nsys 4m9,296s\nRun Code Online (Sandbox Code Playgroud)\n\xc2\xb9 最后的时间是因为我调用的是$ time <program> +RTS -N3 -M9G -s -RTS <args-for-program>
操作系统:Ubuntu 18.04.6 LTS
\n计算出的 GC CPU 时间似乎有问题。与过去的 2737 秒相比,这是 41010 秒,如果您只运行三种功能,那么这没有意义。
这种错误计算意味着计算出的 MUT CPU 时间(即总 CPU 时间减去 INIT、GC 和 EXIT 时间)实际上是一个很大的负数 (5073-41010-2 = -35939)。这给出了-35939/5073=-708% 的生产率。显示 MUT 秒时,负数会被截断为零,以避免在 MUT 非常低且存在时钟精度误差时报告小负数,这就是显示的 MUT 时间为 0 而不是 -35939 的原因。
我不知道为什么GC 时间计算得如此严重。我最好的猜测是这样的。如果您在 Windows 上运行,则 CPU 时间时钟精度存在已知问题,并且某些不寻常的垃圾收集计时模式可能会导致仅在一个方向上出现精度错误,从而稍微高估实际 GC 时间。低估了它。超过 240 万次回收(请参阅您的 GC 统计数据),这种差异可能会累积成一个巨大的正误差。
我查看了 GitLab 问题,除了关于一般 Windows CPU 时间不精确的报告以及此处和此处的一些可能不相关的负面 MUT 报告之外,我没有看到任何有用的内容。