profiling the native backend

Matthew Fluet fluet@CS.Cornell.EDU
Fri, 3 Nov 2000 14:37:06 -0500 (EST)


Here's what Henry had mentioned a few weeks ago about profiling: 

> With regards to profiling in the native version, the current profiler
> (truly a hack) just uses the debugging information to get a correlation
> between instruction addresses and C source lines, and scans the C source
> to get the correlation between C source lines and CPS names.  I suspect
> that what will need to be done is to add debug symbols into the native
> generated code to communicate this to a third program. 

> All the profiler actually collects is a vector of counts: the number of
> times a periodic interrupt found the program counter in a certain range. 
> I believe that one counter covers 4 or 8 bytes of instructions. 


Since the native backend is compiled with ChunkPerFunc, will it be
sufficient to correlate instruction addresses and which chunk it belongs
to?  If so, it seems that it would be fairly easy to wrap each emitted
chunk in the following:

FunctionName_begin:
<normal emitted instructions here>
FunctionName_end: