简体   繁体   English

SICStus Prolog 垃圾收集跟踪消息

[英]SICStus Prolog garbage collection trace messages

Browsing through theSICStus Prolog User's Manual I stumbled upon the Prolog flag gc_tracing .浏览SICStus Prolog 用户手册我偶然发现了 Prolog 标志gc_tracing

I wanted to know more, so I started at the "Book Index" and found 3 entries for gc_trace :我想知道更多,所以我从“图书索引”开始,找到了gc_trace的 3 个条目:

G G
gc_trace (prolog flag): ref-lps-flg (#1: "4.9.4 Prolog Flags") gc_trace(序言标志): ref-lps-flg (#1:“4.9.4 Prolog标志”)
gc_trace (prolog flag): ref-mgc-egc (#2: "4.10.3 Enabling and Disabling the Garbage Collector") gc_trace (prolog flag): ref-mgc-egc (#2: "4.10.3 Enable and Disabling the Garbage Collector")
gc_trace (prolog flag): ref-mgc-mgc (#3: "4.10.4 Monitoring Garbage Collections") gc_trace (prolog flag): ref-mgc-mgc (#3: "4.10.4 Monitoring Garbage Collections")

When I followed the links, I found the following:当我点击链接时,我发现了以下内容:

4.9.4 Prolog Flags 4.9.4 Prolog 标志

gc_trace gc_trace

Governs global stack garbage collection trace messages.管理全局堆栈垃圾收集跟踪消息。

verbose Turn on verbose tracing of garbage collection. verbose打开垃圾收集的详细跟踪。
terse Turn on terse tracing of garbage collection. terse打开垃圾收集的简洁跟踪。
off Turn off tracing of garbage collection (the default). off关闭垃圾收集的跟踪(默认)。

4.10.3 Enabling and Disabling the Garbage Collector 4.10.3 启用和禁用垃圾收集器

[...] To monitor garbage collections in verbose mode, set the gc_trace flag to verbose. [...] 要在详细模式下监控垃圾 collections,请将 gc_trace 标志设置为详细。 [...] [...]

4.10.4 Monitoring Garbage Collections 4.10.4 监控垃圾 Collections

By default, the user is given no indication that the garbage collector is operating.默认情况下,不会向用户提供垃圾收集器正在运行的指示。 If no program ever runs out of space and no program using a lot of global stack space requires an inordinate amount of processing time, then such information is unlikely to be needed.如果没有程序用完空间,也没有程序使用大量全局堆栈空间需要过多的处理时间,则不太可能需要此类信息。

However, if a program thought to be using much global stack space runs out of space or runs inordinately slowly, then the user may want to determine whether more or less frequent garbage collections are necessary.但是,如果一个被认为使用大量全局堆栈空间的程序空间不足或运行异常缓慢,那么用户可能想要确定是否需要更多或更少频繁的垃圾 collections。 Information obtained from the garbage collector by turning on the gc_trace Prolog flag can be helpful in this determination.通过打开 gc_trace Prolog 标志从垃圾收集器获得的信息可能有助于此确定。

On the spectrum " off - terse - verbose ", I'd say: Terse!在“关闭 - 简洁 - 冗长”的范围内,我会说:简洁! Haha, only serious:)哈哈,只是认真的:)

Finally, without any further ado, here is my actual question:最后,事不宜迟,这是我的实际问题:

Given the verbosity flags of the OCaml garbage collector, find suitable combinations corresponding to the SICStus Prolog GC verbosity levels " off ", " terse ", and " verbose ".给定 OCaml 垃圾收集器的详细程度标志,找到与 SICStus Prolog GC 详细程度级别“关闭”、“简洁”和“详细”相对应的合适组合。


From the OCaml User's Manual :OCaml 用户手册

Module GC GC模块

mutable verbose: int;

This value controls the GC messages on standard error output.此值控制标准错误 output 上的 GC 消息。 It is a sum of some of the following flags, to print messages on the corresponding events:它是以下一些标志的总和,用于在相应事件上打印消息:

0x001 Start of major GC cycle. 0x001主要 GC 周期开始。
0x002 Minor collection and major GC slice. 0x002次要收集和主要 GC 切片。
0x004 Growing and shrinking of the heap. 0x004堆的增长和收缩。
0x008 Resizing of stacks and memory manager tables. 0x008调整堆栈和 memory 管理器表的大小。
0x010 Heap compaction. 0x010堆压缩。
0x020 Change of GC parameters. 0x020 GC 参数更改。
0x040 Computation of major GC slice size. 0x040主要 GC 切片大小的计算。
0x080 Calling of finalisation functions. 0x080调用终结函数。
0x100 Bytecode executable and shared library search at start-up. 0x100启动时字节码可执行文件和共享库搜索。
0x200 Computation of compaction-triggering condition. 0x200压缩触发条件的计算。
0x400 Output GC statistics at program exit. 0x400 Output 程序退出时的 GC 统计信息。 Default: 0 .默认值: 0

end_of_file

The terse value prints just a brief indication that a GC is about to happen. terse的值仅显示 GC 即将发生的简短指示。 The verbose value prints more details about the GC. verbose值打印有关 GC 的更多详细信息。 The details are undocumented and subject to change, ie they are for human consumption.详细信息未记录在案,可能会发生变化,即它们是供人类消费的。

The SICStus GC does have something akin to "minor" and "major" collections but the verbose output is the same for both minor and full collection. SICStus GC 确实有类似于“次要”和“主要”collections 的东西,但verbose的 output 对于次要和完整收集都是相同的。

When memory areas change size is not a "garbage collection", as such, and there is currently no way to get indication when this happens (except after the fact, by calling statistics ).当 memory 区域改变大小时不是“垃圾收集”,因此,目前没有办法在这种情况发生时得到指示(除了事后,通过调用statistics )。

I do not know the OCaml memory manager, but I guess that the non- off value corresponds mostly to the first two ("Start of major GC cycle" and "Minor collection and major GC slice.") OCaml flags.我不知道 OCaml memory 管理器,但我猜非off值主要对应于前两个(“主要 GC 周期开始”和“次要收集和主要 GC 切片。”)OCaml 标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM