IOS debugging tool and ios debugging tool

Source: Internet
Author: User

IOS debugging tool and ios debugging tool

  • Instrument

Xcode5 introduces a debugging instrument that intuitively shows the CPU and memory usage of the application. Run a program and click the meter bar. It can be found that when the program is running, the debugging navigation panel displays the CPU and memory usage in a bar chart, and the consumption data is updated in real time with the application. Note that the data in the debugging navigation panel is calculated based on the hardware of the application. The CPU of the Apple Computer is faster than that of the iOS device. If you run the application on the iOS simulator, the CPU likes displayed on the debug navigation panel may be very low, not lower than the analysis performance.

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

  • Precentage Utilized)

The CPU usage ratio is displayed based on the number of CPU cores of the running application device. For example, the maximum CPU usage of a Single-core device is 100%, while that of a dual-core device is 200%. Therefore, the CPU usage of applications on a single-core device is usually higher than that on a dual-core device. If the application is idle (no operation is performed when the application enters the background), the CPU usage is 0%.

  • Utilization Comparison)

Use a period-over-period chart to compare the CPU usage of other processes in the application and system. If the CPU usage of the application is not high, but the operation is not smooth, you can view the usage percentage of Other Processes in the ring chart. If there are too many Other applications running in the background of the device, the usage of Other Processes may be high, and the application runs slowly.

  • Time-usage ratio (Utilization over Time)

Use a line chart to display the process in which the CPU usage of an application changes with the running time, as well as the peak and valley values during the running time.

  • Thread (Threads)

Displays the time-usage ratio of each thread in the application.

  

Next we will open our application JXTouchTracker, draw lines in the application with your fingers, and do not leave the screen with your fingers, by drawing a large number of lines, you can find that the CPU usage ratio of the application increases rapidly-when your fingers move on the screen,JXDrawViewYou will receive the touchesBegan :( NSSet <UITouch *> *) touches withEvent :( UIEvent *) event message and call drawRect :( CGRect) rect to repaint yourself. The more lines drawn, the greater the workload of the drawRect (CGRect) rect, the higher the CPU usage ratio.

Return to the hanging event navigation panel and click Memory to open the Memory usage report,

Similar to the CPU usage report, the memory usage report directly shows the memory usage of the application. However, the line chart shown in the Memery section (at the bottom) may cause us to misunderstand: the application seems to have always occupied 100% of the memory. In fact, the peak usage during the running time is shown as 100%, so the maximum value of week y on the way is 58.2 MB as shown in the left High column.

Regardless of the type of application developed, the CPU and memory usage should be minimized to improve the smoothness and user experience of the application.

 

  • Instruments

The performance of the application can be briefly analyzed from the instrument and consumption report. However, if the CPU and memory usage of the application is too high, you need to find performance problems from the code, you can use Instruments, he provides more detailed data analysis than meter and usage reports.

Instruments is a debugging tool that is closely integrated with Xcode. It can monitor and collect various data during application running in real time and generate detailed analysis reports. It consists of several components. The component check items include the objects created by the application, CPU usage of each method and function, file I/O, and network I/O. By using these different components, you can identify performance bottlenecks in the program and discover problems in the code.

  • Allocations component

The Allocations component can list all created applications for this role and the memory size occupied by these objects.

When you monitor an application, the Allocations component performsPerformance Analysis. Although performance analysis can be performed on an application on a simulator, more accurate data can be obtained on a real device.

To perform performance analysis on the currently opened project, you can hold downRunButton, and then selectProfile.

Xcode starts Instruments. Instruments displays a drop-down window and lists all available components. Select Allocations. Then, Instruments starts the application and opens the main window of Instruments.

 

 

The Allocations component displays a table showing all memory Allocations executed by the outbound application. Because there is a lot of data, we should first filter out and only list the objects created by the Code Compiled by ourselves. FirstJXDrawViewDraw several lines on the object. Then in the windowCategoryEnter in the query boxJXLine.

The Allocations component filters the entries displayed in the Object Summary table, listing andJXLineMemory allocation on the right side, that is, the memory we createdJXLineObject.

# The Persistent column displays the number of existing objects. The Persistent Bytes column displays the memory occupied by these existing objects. # The Total column shows how many types of objects (including released objects) have been created since the application is running ).

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.