[MLton] getrusage and times?

Stephen Weeks MLton@mlton.org
Wed, 2 Nov 2005 12:13:43 -0800

> There is an odd behavior, it seems to me, that if the program uses
> MLton.GC.setSummary, then the summary at the end only includes
> timing information for the portion of the program during which
> gcState.summary was true.

That is indeed what happens.  The intended usage was to do some simple
computation at program start, and then either turn s->summary on or
not, leaving it in the same state for the duration of the program.

Options I see to address the behavior are:

  1. document it along with its intended usage
  2. change setSummary so that it can only turn s->summary on, not off
  3. eliminate setSummary
  4. always gather the detailed timing information

(1) is the easiest, and least traumatic if people are actually using
it.  (2) addresses turning it on and off repeatedly, although does
nothing to ensure it is turned on near the program start.  I could
live with (3) if others can, since I don't think setSummary is much
used and don't remember the motivation for putting it in MLton.GC in
the first place.  And we still have @MLton gc-summary (and -runtime
gc-summary).  I don't like (4) for performance reasons.

Another option would be to split it into two options, one to control
the end-of-program behavior and one to control whether data is

  val keepDetailedGCTime: bool -> unit
  val setSummary: bool -> unit

It does make it clearer what is being done, but feels like overkill.

Overall, I'd say (1) is the way to go.