#5701 - Berno - Tue May 06, 2003 12:46 pm
Hey, I was wondering if its possible to profile GBA code?? I have read of gprof for gcc but never used it.
Thanks.
#5709 - Touchstone - Tue May 06, 2003 3:36 pm
To get an "all-round" profiler you can sample the program counter (PC) a given number of times during a frame to see what code is currently running. This can be done by writing an interrupt routine in asm that look at the return address, link register (depending on your interrupt handling code), and store it somewhere for you to postprocess by matching the stored PC with the symbolmap produced by the linker. Note that symbols for static methods are not exported!
If you want to measure how many clock-cycles is spent in a function you can write functions/macros for starting and stopping a GBA timer with a given resolution. I think you can link all four timers together to produce 64bit measure value which can measure up to 15.62ms (a frame is 1/60 seconds, i.e. 16.67ms) with highest precision, one clock-cycle.
EDIT: Maybe there are some built-in profiling functions in GCC, I don't know. In that case you might want to use them. :) But if you want to write your own profiling-code then that's what I can help you with.
_________________
You can't beat our meat
#5727 - Berno - Wed May 07, 2003 2:18 am
Hey thanks, I guess I can use the interrupts to do it myself.