time bug

Matthew Fluet mfluet@intertrust.com
Fri, 13 Jul 2001 17:49:10 -0700 (PDT)


> Is  it  intentional  to  copy the struct rusage ru_gc from the gcState to the
> file static gc on calls to MLton_Rusage_ru()?  I guess it might  be  to  copy
> something which might change, but it seems strange.

Yes.  The reason is that we will extract all of the sub-components (from
the ML side) after calling MLton_Rusage_ru().  Because we're back in ML,
we might gc, causing the gcState.ru_gc to change.  This could then give
rise to non-sensical data -- like total gc time exceeding total self time.
I want MLton_Rusage_ru() to give an atomic snapshot.

> The  only thing I would like to get to track down the Time exception stuff is
> to modify MLton_Rusage_ru() in rusage.c to be the following:
>     #include <stdio.h>
>
>     void
>     MLton_Rusage_ru()
>     {
>             gc = gcState.ru_gc;
>             getrusage(RUSAGE_SELF, &self);
>             getrusage(RUSAGE_CHILDREN, &children);
>             fprintf(stderr, "MLton_Rusage_ru: self: user = %ld.%06ld, sys = %ld.%06ld, child: user = %ld.%06ld, sys = %ld.%06ld0,
>                     (long)self.ru_utime.tv_sec, (long)self.ru_utime.tv_usec,
>                     (long)self.ru_stime.tv_sec, (long)self.ru_stime.tv_usec,
>                     (long)children.ru_utime.tv_sec, (long)children.ru_utime.tv_usec,
>                     (long)children.ru_stime.tv_sec, (long)children.ru_stime.tv_usec);
>     }

I'll add these and then let stuff run over the weekend.  But, is this
significantly different than the info you'd get from an strace.