time bug
Matthew Fluet
fluet@CS.Cornell.EDU
Mon, 26 Mar 2001 16:23:28 -0500 (EST)
> > 2. src/lib/mlton/basic/times.{sig,sml}
> > src/mlton/control/control.sml
> ...
> > I updated /src/lib/mlton/basic/times.{sig,fun} with timesPre and
> > timesPost, and bound times to timesPre for compatibility.
>
> Makes sense. Another solution would be to have a single routine that returns
> times, like:
>
> val MLton.ProcEnv.times: unit -> {elapsed: Time.time,
> cstime: Time.time,
> cutime: Time.time,
> gc: Time.time,
> stime: Time.time,
> utime: Time.time}
Wouldn't this suffer from the same problem? Either we query
gcState.gcTime before or after a call to the times() "C" function. We
can't write a gc.c function that returns that whole structure and import
it as a _ffi. I suppose we could set it up in the same way Posix/Tms.c is
implemented; a side effecting _ffi call to atomically store all of the
sub-fields and then individually get each one.
But, I think there is a negligible amount of code duplication in the way
things are set up right now.