[MLton] Question on profile.fun

Matthew Fluet fluet@cs.cornell.edu
Wed, 1 Jun 2005 13:48:25 -0400 (EDT)


> > Also, I've noted that even with the current implementation, sometime
> > basis code is marked in time profiling.
> 
> Perhaps the flag name is misleading.  -profile-basis controls whether
> the internals of the basis library are profiled. 

Ok.  I was being misled by the name.

> > Finally, and much to the chagrin of those wanting to map source code onto 
> > assembly code, I wonder if we can't simplify time profiling by associating 
> > a  currentSourceSeq  field in the gc state and having  profile.fun  
> > explicitly change the field as appropriate when time profiling.  
> 
> This approach is too intrusive -- it would interfere too much with
> running time, and defeat the purpose of time profiling.

Really?  Could you elaborate?  You believe that the move of a constant 
integer to a known slot in the gc state at transitions in the profile 
graph is too intrusive?  It would seem to simplify GC_handleSigProf down 
to:

void GC_handleSigProf () {
	uint frameIndex;
	GC_state s;

	s = catcherState;
	if (DEBUG_PROFILE)
		fprintf (stderr, "GC_handleSigProf ()\n");
	profileInc (s, 1, s->currentSourceSeqIndex);
}

which would appear to reduce the time handling a profile signal.