Thu, 23 Aug 2001 10:14:24 -0700 (PDT)
I've been thinking about extending profiling to gather allocation stats.
Essentially, I'd like to reuse the existing profiling infrastructure
(mlprof, mlmon.out file structure, even the bin datastructure and file
output in prof.c, if possible). Ideally, I'd like to just change every
addl X,(appropriate bin)
Now, when you ran mlprof, you'd see the % of total program allocation done
in each CPS function and in each CPS block.
It seems to me that by the time the entire program is linked, then
the address of the appropriate bin can be known -- it's just
(bin_addr + (current_addr - text_sec_start_addr))
so, I want to write
addl X,(bin_symbol + (. - _start))
(Yes, this is slightly different than the way prof.c is set up right now.
I was thinking of linking in an assembly directive that allocated space
for the bins in the bss section.)
But, I can't even get (. - _start) to assemble; the _start symbol is
unknown in the current file. Am I just stuck?
I know I can do it with a few additional instructions to compute the
address, but the goal had been to not need any additional registers.