gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Timing again - no$gba question

#132903 - sourcerer - Sun Jul 01, 2007 1:50 pm

Kinda offtopic but alas...gotta try.

Since I am a low level coder by profession I am fairly interested in cycle counts. I've read some of Cearn's posts and I see he knows cycle counts for certain routines by using no$gba.
My question is....you need the profiler version for this, right? - Something that's not really an option for me as the DS coding is purely a spare time gimmick to keep me uptodate.

Anyone who has the debugger version who can tell me if that can count execution time for fragments of code (except adding the cycle counts yourself?)

Thanks in advance....or would that be thanks in DS....

Kaj

#132904 - Cearn - Sun Jul 01, 2007 3:08 pm

I didn't use the profiler for that, I just used the timer registers and printed the outcomes.

I'm not sure if no$gba+timers would really work for DS purposes, though. I did some checks a (long) while ago, but no$ didn't give me anything close to hardware. This is probably because
  1. The ARM9 is not the ARM7. Cycle times are different and I'm not sure if the no$gba core is updated for that. For documents on timing details and other things, see forum:t13379.
  2. Cache, which may or may not interfere with taking reproducible readings or not be representative of a Real-Use environment.
Now, this was some time ago, so maybe no$gba has added support for these items by now. But if it hasn't, you can always try it on hardware, of course.

#132915 - sourcerer - Sun Jul 01, 2007 5:14 pm

Thanks heaps for the reply and the link, will be delving into it.

Kaj

#132927 - Ant6n - Sun Jul 01, 2007 8:36 pm

to illustrate the above; 6000 nop's without branching in ewram take ~17250 cycles on hardware, but only ~12000 on nogba. also, nogba doesnt know that code in itcm runs at 66MHz, so all counts give twice the number of actual cycles. additionally it seems nogba's timer isnt cycle accurate, it seems to count up only every couple (hundred?) cycles.
if you are really interested in how many cycles instructions take, take a look at http://www.arm.com/pdfs/DDI0165B_9ES_trm.pdf. the things said there seem to only apply apply for code in itcm and data in dtcm