What is a good performance profiler for iPhone games made w/ objective-C and XCode? - iphone

I'm writing an iPhone game in objective-C using XCode. I'd like to profile the performance of my code. What is a good profiler to use?

Have you tried Shark? it comes with the developer tools.

Apple provides a program called Instruments, which is included with the iPhone SDK download, that really is excellent. It allows you to view memory leaks, animation performance, and a bunch of other stuff.

The developer tools you downloaded also included a great app called Instruments. You'll find it in your Developer folder next to Xcode:
/Developer/Applications/Instruments.app
Instruments works great for profiling and also has some preset modes that you can use to track down memory leaks, view how many instances of various objects have been created, monitor your OpenGL performance, etc.
To use Instruments, just build your app in Xcode, then while still in Xcode, launch Instruments from:
Run > Start With Performance Tool > Instruments Templates
…then select the type of performance monitoring you'd like to do.

Shark is an incredible profiler, included as part of Apple's CHUD tools, with XCode. If you can get that to run in, say, the simulator, you will be extremely pleased with the results it provides.

Just wanted to plug a set of profiler macros I created for iPhone. You can profile in the traditional sense vs sampling w Shark. It also doesn't require any special tools and the output is saved to a file in your app's Documents folder.
http://code.google.com/p/iphone-quick-profiler/
.n

Related

How to add and use "ObjectAlloc" and "MallocDebug" in the instrument tool

I am trying to know memory allocated to each view in my App.I am doing it via instruments provided in Xcode.
When i am using instrument in xcode then i am able to see the Tools for leaks and allocation but i am unable to see "ObjectAlloc" and "MallocDebug" tools.
I searched this in the instrument library but it was not showing in the list.
So how to use that tool..
is there any better tool to know memory at each step in my app
Thanks and regards
These are older standalone apps that you seek, formerly distributed with Xcode.
ObjectAlloc: search "Allocations" in Instruments' Library.
MallocDebug: Generally, you'll just set these variables in Xcode's Product Scheme Editor, at Run PRODUCT > Diagnostics > Memory Management.
Options can be found here.

Quickly testing iOS and objective-c code

I was wondering if is there any way to quickly check iOS/objective-c snippets or new code inside my xcode project without having to compile the whole app for that, open up the simulator just to get the NSLog message traced on the console.
I remember when life was easier using ruby's irb or node command for node.js :)
It just gives me the impression that on iOS development you have to learn how to deal with this high complexity and dependencies all the time, but I am just starting on this new world. so any help would be appreciated.
thanks a lot
This timely blog post should help; I'm using it often already.
Update: there is also Code Runner available in Mac App Store - this supports many languages, including Objective-C.
An Xcode project can contain multiple targets. One of the targets can be a test driver in which you can put some class/object/snippet exercise code and drive it from the command-line, results to the debug console. Another option is to create unit test targets.
If the code you're writing has known expected input-output pairs and you're just writing code to make them work, you may want to look into using XCode's unit testing capabilities. A link to a tutorial on using unit tests is at http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/UnitTesting/0-Introduction/introduction.html . If you want to test more interactive things, it is possible to use Instruments (a program in XCode) to automate those tests as well using the Automation instrument. A guide on using Instruments is available at http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/AboutTracing/AboutTracing.html .
Not really—Objective-C is a compiled language, while I believe Ruby is interpreted (which allows for interactive testing like what you describe). You can reduce some of the overhead of building and running your project by just leaving the simulator open; stopping the app from Xcode will close the app but leave the simulator running, meaning that a rebuilt version of the app will launch more quickly when you run it.

Does Apple ship debugging symbols for the iPhone Simulator APIs?

I am a bit of a iPhone/Mac OS newb.
When I look at a backtrace in the debugger and UIKit or other Apple Libraries are on the call stack I can't see their function arguments because of missing debug symbols.
Does Apple Ship debugging symbols for the iPhone Simulator libraries like UIKit?
Thanks.
No. The OS-level components do not ship with debug symbols, nor have those symbols available to you. On the Mac, the only case I can think of where a special debug version of a framework was made available was for Core Data, but that was more for logging of SQL and other database-related actions.
You can extract a little more information about what's going on in the Simulator using DTrace scripts and custom instruments, which can probe for even private methods and classes. For example, I created a couple of scripts and a custom instrument here that logs out every method that is called in the process of starting up an iPhone application in the Simulator. I describe how that works in this article on MacResearch.

Is it possible to load other applications in Instruments?

I’d like to use Instruments to peek at some third-party applications on my iPhone, is that possible? If I attach Instruments to some of the applications I develop, everything goes well. But when I try to load some other application, Instruments complain that they can’t “get task for pid XY.” Is that a security measure?
This is the iPhone telling you that the app you're trying to run won't let the debugger attach to it. Without a debugger attached you can't run Instruments.
This is an intentional security measure, withut hacking the 3rd party apps you will not be able to view them in Instruments.
Hey.
From Instruments documentation:
For your protection, the instrument does not allow you to process any application that is not
code-signed with your provisioning profile. This includes any copy that has been downloaded from the iTunes App Store.

iPhone: iPhone application testing

First, Thanks to all for your quick help for any questions asked in this forum.
I just want to know what are the testing tools coming up with Xcode on Mac as i need to test my iPhone application professionally (or) What do you suggest to use debug and test my application using any (or) built-in tools?
Thanks.
The first thing I try is Xcode's "Build and Analyze" menu command.
Next thing is to run Instruments and look for memory and object allocations and disposal. Instruments should keep you busy for quite a while as it can provide you a wealth of information, including network performance and graphics utilization.
When using instruments, the first method you should check is memory allocation and leaks. When your application leaks, it will spike. Click on this leak and then extend the details to find the exact whereabouts of the leak.
However read the documentation on it all first.
Documentation