Use OpenGL ES tracer in Android to analyze the rendering process

Source: Internet
Author: User

Tracer for OpenGL ES (http://developer.android.com/tools/help/gltracer.html) is a newly added development tool in Android SDK, which can record the rendering process of OpenGL ES for apps by frame (more accurately, by function. It provides the time consumed by each OpenGL function call, so it is often used for performance analysis. However, because of its powerful record function, it can be considered a major artifact in analyzing rendering errors (especially when there is no source code. Disadvantages: one is that only Android 4.1 and later devices are supported, and the other is that the app runs slowly during data collection (which may affect app behavior ).

Procedure:

1. connect to the device, and then enable device Monitor (in Android-SDK/tools/monitor) or eclipse (if ADT is installed ), then window-> open perspective-> Other-> tracer for OpenGL ES.

2. Click and fill in the app information to be analyzed. The package name and activity name can be obtained from androidmanifest. xml by extracting the APK file, or by opening the app and using

$ ADB shell dumpsys activity | grep app name

. Then, you can check all the hooks and start with trace. Example:

3. The trace log file is generated under the predefined directory after "Stop tracing" is finished.

4. Click to select the generated trace log file, and then you can analyze it. For example:

The slider in the upper left corner is the frame number. It is used to adjust the frame painting process.

The lower-left corner shows the drawn functions that have been run in this frame. The drawn functions are displayed in blue. Click a function, and other windows will display the function execution result accordingly. For example, after the gldrawarrays function in the dot graph, the GL status content in the center also changes accordingly, and the preview in the upper right corner also changes to the effect after the function is executed. The vertex coordinates and texture coordinates can be obtained by clicking glvertexattribpointerdata in front and then from the Details window. Currently, texture, shader, and buffer information can be obtained from the intermediate GL status window. We can see that this function is used to draw the background. Because the draw function is not executed yet, other elements in the middle of the screen have not been drawn yet.

The intermediate window is in OpenGL state. OpenGL is like a state machine. The current drawing effect is affected by the current GL state, and the current GL state may be set long ago. This information greatly facilitates our analysis.

The window in the upper-right corner shows the rendering effect after the selected function is executed.

The window in the lower right corner shows the rendering effect after all functions of the frame are executed, that is, the effect after the frame is drawn.

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.