views:

144

answers:

4

I've just come off the PSP where performance testing was easy. You just turned off 'vsync' and printed out the frameratem, then change something and see whether the frame rate goes up or down...

Is there any way to do the same thing on the iPhone? How do you turn vsync off? The Instruments tool is next to useless. Its chief problem being that it running it adversely affects the performance of the app! Also, the frame rate it reports is extremely sporadic.

I don't want any fancy tool that reports call trees and time spent in each function. I just want an unrestricted frame rate and some way to see what it is. Is there a high precision counter that you can use on the iPhone? Something like QueryPerformanceCounter in windows?

Also, is there anyway for you to somehow KILL backround processes so you know they can't effect the performance, perhaps solving the sporatic frame rate problem?

A: 

You're taking the try-something-and-measure approach. Very indirect. It's easy to tell exactly what is taking the time; it doesn't depend on what else is going on and doesn't require learning a new tool. All you need is a debugger that you can interrupt.

Mike Dunlavey
so the idea is. just keep pausing and resuming the debugger, and the function it pauses on the most is the one you should optimize first, be it because its called a lot or because it takes along time? sounds good in theory. but the problem is, with threading and stuff ect. for instance, when you hit pause, the debugger might have to wait until it the code hits a wait. for instance I tried this on my Iphone app, and it breaks at the same point everytime. completely in system code (no functions of mine). have you tried this on the iphone? can you list some platforms/ debuggers where it works?
matt
@matt: Two things. 1) look at the call stack as well, because all the lines of code on the stack are jointly responsible for it being in the state it's in. If any of them could be done less or not at all, time would be saved. 2) Thread A could be waiting for thread B, so it's best if you can snapshot all the threads in the process. That should shine a light on your problem, unless there truly is nothing left to optimize. Give those a try, and good luck.
Mike Dunlavey
A: 

You can't kill background processes on the iPhone. That would make it possible for a buggy or malicious app to interfere with the phone function and the needs of all other functions on the iPhone are subordinated to the phone.

TechZen
Not a valid reason. The background processes will be killed first when memory is low anyway. And killing Phone.app won't interfere with the phone function either.
KennyTM
A: 

Try QuartzDebug or OpenGL Profiler.

David Dunham
+1  A: 

Profile your app with Instruments and use the Core Animation instrument. It gives a frame rate.

jasoncrawford