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 > How much CPU is used

#142461 - Twindruff - Tue Oct 09, 2007 11:37 am

Hello,
I would like to get how much CPU is used by my main loop
Code:
while(1) {
   // begining
   
   // end
   swiWaitForVBlank();
}
Is there a more precise way than timers ?

#142489 - olimar - Tue Oct 09, 2007 4:12 pm



Last edited by olimar on Wed Aug 20, 2008 10:53 pm; edited 1 time in total

#142495 - Twindruff - Tue Oct 09, 2007 5:56 pm

Ok :P
In fact it's precise enough ^^

#142498 - simonjhall - Tue Oct 09, 2007 6:34 pm

The timers are derived from the 33MHz bus clock, and that's as good as you can get. I've spent a lot of time profiling code on the DS and AFAIK there's nothing better than a timer.
_________________
Big thanks to everyone who donated for Quake2

#142502 - Mighty Max - Tue Oct 09, 2007 6:40 pm

err nevermind
*slaps himself*
_________________
GBAMP Multiboot

#142506 - Twindruff - Tue Oct 09, 2007 8:36 pm

simonjhall wrote:
The timers are derived from the 33MHz bus clock, and that's as good as you can get. I've spent a lot of time profiling code on the DS and AFAIK there's nothing better than a timer.
Yes, I've tried it, it works very well thanks. When I asked the question I didn't know the resolution of the timers was so high ;)