assembly/profiling question
Henry Cejtin
henry@sourcelight.com
Thu, 23 Aug 2001 12:49:10 -0500
The problem is (almost certainly) that you can't use an external symbol in a
negative context. I.e., all uses of externals must be external+constant.
If you want to profile allocation (which you can't do if you are also
profiling run time since it would skew the times) then wouldn't it be easier
to just add one extra word allocated which had the program counter? I'm
thinking that the GC would first do a scan of the old space and write out the
data. Maybe this is more trouble.
Ah, how about this technique (a bit more expensive run-time wise): every
allocation point (or function, or what ever granularity you want) allocates a
counter which also has a link field. Then allocation (or entering the
allocation region) consists of if link NULL: link =
start of list of used bins start of used bins = my counter
The result is that on exit you have a linked list of all the counters that
were used.
I seem to recall that some scheme like this is what gprof uses for its
function call counts.