IOS Debugging Tools

Source: Internet
Author: User

    • Instrument

The xcode5 introduces a debug meter, which intuitively shows the CPU and memory usage of the application. Run a program and click on the Dashboard bar. You can find that when the program is running, the debug navigation panel displays the CPU and memory footprint in a histogram and updates the consumption data in real time as your app does. It is important to note that the data in the Debug navigation panel is calculated based on the application's hardware, the CPU is faster than the iOS device, and if the app is running on the iOS emulator, the CPU-like usage shown in the debug navigation panel may be very low, not less than the analysis performance issue.

Click CPU to open the CPU usage report in the editing area.

    • Occupancy percentage (Precentage utilized)

Displays the CPU consumption ratio based on the number of CPU cores running the application device. For example, the maximum CPU consumption in a single-core device is 100% and 200% for a dual-core device, so CPU usage in a single-core device is typically higher than a dual-core device. If the app is idle (no action is taken into the background), the CPU consumption will show 0%.

    • Occupancy chain (Utilization Comparison)

Use the chain graph to compare the percentage of CPU consumption applied to other processes in the system (process). If your application's CPU usage is not high, but the operation is not smooth, then you can view the percentage of other processes from the doughnut chart. If there are too many other apps running in the background on the device, it can result in a high percentage of other processes and slow application performance.

    • Time-to-occupancy ratio (utilization over times)

Use a line chart to show the process of applying CPU consumption over time and the peak and valley values for the elapsed time of the consumption.

    • Thread (Threads)

Displays the time-to-occupancy ratio for each thread in the app.

  

Next we open our app Jxtouchtracker , draw lines with your fingers in the app, keep your fingers out of the screen, and draw a lot of lines to see that your app's CPU usage is rising faster-when your finger moves on the screen,Jxdrawview will continue to receive Touchesbegan: (Nsset<uitouch *> *) touches withevent: (uievent *)event message and call DrawRect: (cgrect) rect redraws itself. The more lines you draw, the greater the workload of DrawRect: (cgrect) Rect , the higher the CPU occupancy ratio.

Go back to the hang-up navigation panel, click Memory, and open the RAM consumption report,

Similar to the CPU consumption report, the memory consumption report directly shows the application memory footprint, but the line chart shown in the Memery section (at the bottom) can be misleading: The app seems to always occupy 100% of the memory. In fact, the peak of the run time is shown as 100% on the way, so the maximum Y-week is 58.2MB the same as the value shown in the high bar on the left.

Regardless of the type of application you develop, you should minimize CPU and memory consumption, improve application fluency, and user experience.

    • Instruments

The performance of the application can be briefly analyzed from the gauge and footprint reports, but if the CPU and memory consumption of the app is too high and you need to look for performance issues from your code, you can use Instruments , which provides more detailed data analysis than the gauge and footprint reports.

The Instruments is a debugging tool that is tightly integrated with Xcode to monitor and count data from the application runtime in real time, generating detailed analysis reports. It consists of several components that examine things such as how the application created those objects, the CPU consumption of each method and function, file I/O, and network I/O. By using these different components, you can identify performance bottlenecks in your program and discover problems in your code.

    • Allocations Components

The Allocations component can list all of the memory that the app has created and the amount of RAM that these objects occupy.

When you monitor an app, the allocations component performs a profiling of the application. While you can perform a performance analysis on an application on the emulator, you can get more accurate data on the real device.

To perform profiling on a currently open project, you can press and hold the Run button located in the upper corner and select Profile in the new pop-up window.

Xcode will start Instruments . Instruments displays a drop-down window and lists all available components. Select Allocations . Instruments will then launch the app and open the Instruments main window.

The Allocations component displays a table that exits all memory allocations that the app has performed. Because the data is much more, filtering first lists only the objects created by our own code. First draw several lines on the Jxdrawview object. Then enter jxline in the window Category query box.

The allocations component filters the entries shown in the Object Summary table and lists only the memory allocations on the right side of the Jxline , which we created ourselves Jxline object.

The #Persistent column shows the number of existing objects for an object. The persistent Bytes column shows how much memory these existing objects occupy. The # Total column shows how many types of objects (including objects that have already been disposed of) have been created by the app since it was run.

IOS Debugging Tools

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.