profiling
Matthew Fluet
fluet@CS.Cornell.EDU
Mon, 23 Apr 2001 13:09:51 -0400 (EDT)
> > After putting in a workaround for the Posix.ProcEnv.times bug I mentioned
> > earlier today, I did successfully generate a G1, which fails with a Time
> > exception (unrelated to the Posix.ProcEnv.times bug, I assume) whenever I try to
> > compile anything.
>
> Oh yeah, I meant to say "compile anything -v2".
I think I've solved this one.
> 2. modified gc.c to update ru_gc appropriately (i.e., perform
> getrusage(RUSAGE_SELF, &ru_start) just before the gc, perform
> getrusage(RUSAGE_SELF, &ru_finish) just after the gc,
> and set ru_gc = ru_gc + (ru_finish - ru_start),
> where I've defined appropriate rusagePlus and rusageMinus functions).
Turns out that my "appropriate" Plus and Minus functions were too naive.
In particular, I wasn't keeping the usec field of the ru_utime and
ru_stime fields in the range 0 <= usec < 10^6. This was really only a
problem with the gc, which could end up with a negative usec, which raises
Time in Time.fromMicroseconds. (I guess the usec field could also
overflow, although that would just make the time recorded inaccurate.)
Updated gc.c is at:
http://www.cs.cornell.edu/People/fluet/MLton/gc.tgz