[MLton] MLton.Rusage.measureGC

Henry Cejtin henry.cejtin@sbcglobal.net
Tue, 25 Apr 2006 15:53:46 -0500

I am confused by the logic and default value for the bool set by the function
MLton.Rusage.measureGC.  On the other hand, I am also confused about what  it
means to set it to false.

It  seems  from  a  test  that  if  I  don't set it and I don't use either of
gc-summary or gc-messages, that time spent in the GC counts both in  the  #gc
and  #self  members  of the record.  This is the same behavior if I set it to
true.  (I don't quite see how that happens since gc.c initializes the  member
of  the  C  struct  to  FALSE  and needGCTime() would only return true if the
member were TRUE, or DEBUG, summary or messages were going on,  and  none  of
these were.  In fact, the struct member is NEVER set to any thing but true in
any code I can find.)

If I set it to false then it only counts in the #self time and the  #gc  time
is 0.

I  assume  that  the  only  reason  behind  this  is  to save the CPU time in
computing the start and end times around a GC and adding it to the total.  If
that  is  the case, then the documentation should say that, and it should say
that this (that which is set by MLton.Rusage.measureGC) only controls whether
the #gc accumulates the GC time and that it goes to #self regardless.

Also, it seems that the default really should be false, but it isn't (despite
what the code looks like).

Am I missing something?