Apple Instruments/shark Performance Tuning Tool overview

Source: Internet
Author: User
<span id="Label3"></p><pre>On Mac OS x you can use UNIX tools such as gprof to test program Performance. Of course, Apple also has its own profiling Tools, with more Shark. 10.5 also introduced a dtrace-based program called Instruments.<strong><strong>Instruments</strong></strong>Since Xcode 3.0, Apple has provided an unusual way to debug an application, which is Instruments. Just like its name (instruments), instruments provides a time-line interface like Apple's music authoring software garageband, which visually records the various performance indicators of an application like a score. Instruments can record the operation of the entire application and display all information in chronological order, allowing you to visually compare and analyze various "instruments" (analysis tools)--cpu usage, network, file activity, memory allocation, etc. Because this information is displayed in a time-aligned way, you can quickly locate a fragment in the Application's running process, such as looking at what the disk is doing when the last CPU Spike. A holistic view of the Application's operational state can help you better understand the causal relationships and improve software performance. Instruments with the Universal Access feature built into the operating system, it is possible to document user interactions during application runs and then easily repeat the same operation over and over Again. This allows you to create a specific test for your application at any Time. Record the behavior of the application in instruments, modify the code, and then return to the re-test to see the effect of the Modification. Running the application in the template allows the instruments to visualize the performance and memory overhead of the modified code in a way that is visually parallel to each running State. In fact, most instruments analysis tools are implemented using dtrace, which is a global analysis tool in the system that fully acquires the system activity of the Upper-level application behavior to the underlying operating system kernel. You can also create your own analysis tools and use Instrument Builder to create custom powerful analysis Tools.<strong>the <strong>following six types of analysis tools are already included in the Instruments:</strong></strong>• User Events: track the exact events of user interaction, such as mouse clicks. CPU and Processes: Monitor system activity, sampling, load graphs, and THREADS. • Memory: tracks garbage collection, object allocation, and Disclosure. • File activity: monitor disk activity, read-write, and file locks. • Network activity: measure and record network Traffic. • Graphics: explains the intrinsic work of OpenGL Drivers.<strong><strong>Shark</strong></strong>Shark is probably the favorite profiling tool for Mac Developers. Shark's User Guide Writes: "by default, shark creates a profile by periodically interrupt each processor and sampling the current process, thread, instruction address, and function callstack." This means that you do not need to modify or recompile the program to use Shark. also, Shark has a small impact on program performance because "all the sampling work is done in kernel and is based on the hardware interrupts". therefore, shark is particularly helpful in locating the "hot-spot" in the Program. In general, you only need to use Shark's time profiling feature: Run the program you want to test, run shark, Select the process where your application is located, and then press the Start button to start sampling. When you want to end the sample, press the Stop button, and shark will generate A. Mshark file with all the profiling Data. Open the file directly with shark and you can start analyzing the Data.<strong><strong>Gprof</strong></strong>Shark is easy to use, but it doesn't tell you that the same function has been called a few times and all the caller are who this information is. In order to get this information, you need to use a tool such as Gprof. The use of gprof is more complex, simply put, you need to go to the Xcode compiler settings, Open the "Generate Profiling Code" setting. Gprof will add some extra code to your code to collect the information, so after you change the Xcode settings, you need to Recompile. Note that if your application comes from more than one project, you need to change the compilation settings for all of the project you are interested IN. next, after recompiling, run your program, after completion of the normal exit program (otherwise Gprof may not be able to correctly generate profiling files), gprof will be in the folder where the executable file to create a gmon.out file. finally, you need to run the GPROF command in terminal to get a file for human Analysis.<strong><strong>Quartz Composer</strong></strong>Quartz Composer is a graphical development tool introduced in Mac OS 10.4, QC makes it easy to use OS x graphics technology at every level: you can use QC Handy integration cocoa, Quartz, Core Image, OpenGL and Quick Time Technology. A QC composition is made up of many patches and their connections. Each patch acts as a function, with input and Output. Input can come from the parameters you enter, or it can come from output from other Patches. The QC comes with many patches that have been designed to capture the mouse, have a filter for working with the picture, or render the content onto the screen rendering, and so On.</pre><p align="center"><p align="center"><strong>Figure 3.1</strong> Patches</p></p><p align="center"><p align="center"></p></p><pre>Make a wonderful combination of different patches, and you'll get an effect that you don't intend to. In fact, many dj/vj have used QC to make a cool QC composition that varies according to the rhythm of the Music. You can use quick time to play a composition file (. Qtz) directly or as a screen saver. of course, You can also use Qcview or Qclayer to integrate it into your cocoa application.<strong><strong> </strong></strong><strong><strong>Text Editors</strong></strong>Although Xcode has provided a fairly good build-in text editor, you may prefer other Editors. Under Mac OS x, you can find a lot of other great Editors. first, If you are a UNIX programmer, you can still use your favorite VI or EMACS. You can enter VI or Emacs directly under Terminal to enter a version without a graphical interface. If you are an Emacs enthusiast, you can also use Aquamacs emacs or carbon Emacs Two good ported versions with graphical Interface. however, the current Mac OS X on the comparison of a fire editor called textmate, which is a native cocoa program, has a lot of cool features. In particular, TextMate has a lot of snippet for Cocoa (for example, in. mm files you just write the name of the property and then press the TAB key to automatically generate the appropriate setter and getter method), you can thus save a lot of time to knock the Code. At the same time, with the use of bundler, TextMate is extensible, and many developers have developed bundles to support a variety of languages. therefore, TextMate is a good choice if you work primarily on the Mac OS x platform while daring to learn new shortcuts and ways to Operate.<strong><strong>web-related Development Tools</strong></strong>Apple has its own set of long-history frameworks called webobjects, which support AJAX,J2EE and other Technologies. The itunes Music store, the world's largest online media store, was developed using WebObjects technology. Although WebObjects and Java are inextricably linked, the best environment for developing webobjects applications remains xcode. On Web page development, Apple prefers a more new technology like Ruby-on-rail,dojo to support it better. On the tools side, besides Adobe's software, Macs have easy-to-use Web development tools like Coda (last year's Apple Design Award award winning work).<strong><strong> </strong></strong><strong><strong>Other development tools</strong></strong>As mentioned earlier, Mac OS X can find most of the Cross-platform development tools, such as the Java aspect of eclipse, NetBeans. Databases also include oracle, MySQL, filemaker, and so On. These tools are used in a similar way to other platforms and are not specifically described here. In scripting languages, MAC OS x supports the traditional UNIX scripting language, and Apple has its own Apple script Language. In addition, there are scripting languages such as F-script specifically for COCOA. It's also worth mentioning is a IDE called Unity for game Development. Unity supports the export of file formats from mainstream three-dimensional software, such as maya, 3DS Max, blender, and more, with a complete workflow with improved Javascript. And you can compile games or other interactive programs that apply to macs, windows, or even web Pages.</pre><p><p>Apple Instruments/shark Performance Tuning Tool overview</p></p></span>

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.