-dtimings should also report memory consumption #7514
Some of our users are investigating compilation issues where a blowup happen in memory usage of the compiler, rather than time. The -dtimings option is useful to help users extract information on the problematic pass for people trying to fix time blowup issues, having memory consumption information would help similarly debug memory issues.
After briefly looking at the Gc module documentation ( https://caml.inria.fr/pub/docs/manual-ocaml/libref/Gc.html ), I believe that the following information would be useful and could be always reported for each -dtimings output line:
One could consider having a more verbose output available, enabled by an extra flags (-dtimings-gc-stats?), which would collect (Gc.print_stat) calls on start/stop for each timer, but that can be left for later.
(The reason why we want those measurements to be convenient for users to perform is that they have their problematic codebase at hand, and it may be difficult for them to extract an easy-to-build repro-case, and it may be difficult for compiler developers to build their codebase.)
Comment author: @gasche
In an email, Sébastien Hinderer wrote:
I think that -dperfstats or something may indeed be a good idea. I would rather not have two separate -dtimings and -dmemory option, because I think it makes sense to have a single combined hierarchical printing of pass-per-pass information than two separate things being displayed. (But having more advanced options to ask for more specialized/verbose outputs would be reasonable.)
Comment author: @chambart
I think it is ok to change the name of the option. It is a tool for compiler development, if anybody relied on it, they deserve to get their build broken. Especially given that the printing format changed, it would be better to break it in a clearly visible way.
As for the reported information, I think that the most important one is minor-words and major-words. Live words is too unreliable to if one does not trigger a complete collection (and we certainly don't want to do that by default).