Use Shark to tune your iphone app for performance (using Shark to performance Tune Your iphone app)

Source: Internet
Author: User

Use Shark to tune your iphone app for performance (using Shark to performance Tune Your iphone app)

The beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

Reprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses on Agile development and mobile and IoT device research: IOS, Android, HTML5, Arduino, Pcduino , Otherwise, the article from this blog refused to reprint or re-reproduced, thank you for your cooperation.




Use  shark to perform performance tuning for your iphone app
using Shark to performance Tune Your iphone app

The problem is this: we're dealing with An OpenGL IPhone game, for some reason the frame rate is very low-especially when some small operations occur on the screen. The first thing I'm going to deal with is to start making a block comment off the system section to see which module is causing the problem. I removed the physical system, the logic updates, and some things to be rendered. However, I did nothing, as if there were yarrow performance improvements. Now it's time to dive into the system and let Shark find out where the problem is.
Here is the Problem:we were working on a OpenGL iPhone game and for some reason the frame rates were unusually low -especially for what little action is happening on the screens at the time. My first plan of attack is to begin commenting out chunks of the system in a attempt to see what module was causing the Problem. I removed the physics, the logic updates, and some of the things being rendered. Nothing I do, however, seemed to create a noticeable improvement in performance. It is now time for look a little deeper into the system and let shark figure out what is wrong.

Shark is a performance description tool that comes with every version since Mac OS X 10.3 starts. It is part of the Xcode tool. This tutorial will introduce you to Shark, how to use it to describe an IPhone app, and explain the results.
Shark is a performance profiling tool shipped with every version of Mac OS X 10.3 or newer. It comes as part of the Xcode Tools. This tutorial would introduce you to Shark, how to has it profile a iPhone application, and how to interpret the results.

The first thing to do is to get a debug version of the app to download to your phone.
The very first thing you "re going to need to do it get a debug version of the your app onto your phone. If you are ' re to the point of wanting to use Shark, I ' m going to assume you already know how to does this. To make the recording and an analysis a little quicker, we ' re going to target your specific application, which means you ' ll W Ant to go ahead launch it before you launch Shark. You'll also want to run your application outside of the Xcode Debugger-just launch it directly using the phone.

Up next, launch Shark. It should installed here:

/developer/  Applications    performance    tools    shark  

In order to connect Shark to a iPhone, you'll need to a change of the sampling mode to Network/iphone Profiling. You does this through Shark ' s sampling menu.

At this point, your iPhone should is connected to the computer and your app should is running. When your phone appears in the list, simply check the box next to it. Shark should now look something like the image below.

Shark has several different configurations, however time profiles is the one we'll be looking at today. This mode would tell us how much processing time was spent in what functions. Under Target, choose the app, you ' d like to profile. The current name of our app is "Drop N lock" and so that's what I had chosen. When everything was ready for go, just hit "Start".

Shark doesn ' t let you view the performance information real-time. Simply do the actions of you ' d like performance information for and if you ' re-done, hit "Stop". At this point, Shark are going to spend a long time analyzing the sample and then would create a session file that we can re View.

When the report was complete, it would display automatically.

There's lots of ways to view session information, however Tree (Top-down) are the one I like the best. Looking at the "this", we can see that the function responsible for rendering text was taking up 16% of the processing Tim E. When I am first hunting for the problem, text rendering didn ' t even occur to me as a potential problem. And sure enough, when I disabled the text, my frame rate doubled. Obviously we'll need to find a more optimized the to display text.

There you have it. Using Shark is a great a-to-find and eliminate performance bottlenecks in your IPhone applications. It took me no time at all to pin-point exactly where in we code a potential problem was. Unfortunately it can ' t fix the code for You-that and you'll have the your own.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.