time bug

Stephen Weeks MLton@sourcelight.com
Tue, 27 Mar 2001 18:19:23 -0800 (PST)


> > 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.

Yep.  That's what I had in mind.  That way, intervening gc calls don't matter.

> But, I think there is a negligible amount of code duplication in the way
> things are set up right now.

Agreed, but I still want to switch over to getrusage everywhere.  I have no time
the rest of this week, so if you want to, great.  Otherwise, I'll do it next
week.