CPU usage function

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

CPU usage function

Post by youresam »

Does anyone know what the function is to check the CPU usage?

Thanks
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

elaborate your question
10011011 00101010 11010111 10001001 10111010
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

Well, I hear people sometimes say "It uses 20% CPU!", or a good example, that "fake hardscroll" that uses 1% CPU. How do they know how much CPU they are using?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well unlike something like a PC operating system the PSP is not multiprocess or preemptive multitasking, therefore you can be reasonably certain that only your threads are running on the CPU at any one time (with a small amount taken up with interrupt traffic). Therefore to work out roughly what your usage is you can only really base it on your display speed.

Most apps will use the vblank timing (1/60th sec per frame) as the reference for their application, you can use the rtc functions to determine roughly how much cpu you use by measuring how much time elapses between the start of your main loop and just before calling the vblankwait routine. Any spare time in that frame is therefore unused from which you can work out a rough percentage.
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

Ok, thanks!
User avatar
Saotome
Posts: 182
Joined: Sat Apr 03, 2004 3:45 am

Post by Saotome »

How about the Profiler Hardwareregisters in "yet another PlayStationPortable Documentation" (page 48).
You could get the exact cycle count your function or program took then divide by the clock rate your PSP is currently running at.
infj
Post Reply