profiling

Stephen Weeks MLton@sourcelight.com
Fri, 20 Apr 2001 13:43:27 -0700 (PDT)


> My  feeling  is  that  the times system call, which has been in Unix since at
> least version 7, is a bit obsolete and that getrusage() is  the  more  modern
> interface.   Note, there isn't a race condition in getrusage() really because
> the children times are ONLY for children that have  exited  (and  even  then,
> only  if you have waited for them or are ignoring SIGCHLD).  Thus they aren't
> going to magically change between the two calls to getrusage().

At this point I don't really care which is used to implement
Posix.ProcEnv.times, since we're not using it anyway.  I agree with Matthew that
a user would reasonable expect that "Posix.Procenv.times" call the C times
function based on the name.  Also, there is still the issue of three system
calls versus one.  And there is a race condition because of the calls to
getrusage (for the self and child time) and times (for the elapsed time).

But, like I said, I don't really care.