Joe Fernandez | 3e820be | 2012-06-19 15:48:29 -0700 | [diff] [blame] | 1 | page.title=Tracer for OpenGL ES |
| 2 | @jd:body |
| 3 | |
| 4 | <div id="qv-wrapper"> |
| 5 | <div id="qv"> |
| 6 | <h2>In this document</h2> |
| 7 | <ol> |
Scott Main | f284d49 | 2012-07-31 09:46:52 -0700 | [diff] [blame] | 8 | <li><a href="#running">Running Tracer</a></li> |
| 9 | <li><a href="#generating">Generating a Trace</a></li> |
| 10 | <li><a href="#analyzing">Analyzing a Trace</a></li> |
Joe Fernandez | 3e820be | 2012-06-19 15:48:29 -0700 | [diff] [blame] | 11 | </ol> |
| 12 | <h2>See also</h2> |
| 13 | <ol> |
| 14 | <li><a href="{@docRoot}tools/index.html">Tools</a></li> |
| 15 | </ol> |
| 16 | </div> |
| 17 | </div> |
| 18 | |
| 19 | <p>Tracer is a tool for analyzing OpenGL for Embedded Systems (ES) code in your Android application. |
| 20 | The tool allows you to capture OpenGL ES commands and frame by frame images to help you understand |
| 21 | how your graphics commands are being executed.</p> |
| 22 | |
| 23 | <p class="note"><strong>Note:</strong> The Tracer tool requires a device running Android 4.1 (API |
| 24 | Level 16) or higher.</p> |
| 25 | |
| 26 | |
| 27 | <h2 id="running">Running Tracer</h2> |
| 28 | |
| 29 | <p>Tracer can be run as part of the Eclipse Android Development Tools (ADT) plugin or as part of the |
| 30 | Device Monitor tool.</p> |
| 31 | |
| 32 | <p>To run Tracer in Eclipse:</p> |
| 33 | |
| 34 | <ol> |
| 35 | <li>Start Eclipse and open a workspace that contains an Android project.</li> |
| 36 | <li>Activate the perspective for Tracer by choosing <strong>Window > Open Perspective > |
| 37 | Other...</strong></li> |
| 38 | <li>Select <strong>Tracer for OpenGL ES</strong> and click <strong>OK</strong>.</li> |
| 39 | </ol> |
| 40 | |
| 41 | <p>To run Tracer in Device Monitor:</p> |
| 42 | |
| 43 | <ol> |
| 44 | <li>Start the <a href="monitor.html">Device Monitor</a> tool.</li> |
| 45 | <li>Activate the perspective for Tracer by choosing <strong>Window > Open |
| 46 | Perspective...</strong></li> |
| 47 | <li>Select <strong>Tracer for OpenGL ES</strong> and click <strong>OK</strong>.</li> |
| 48 | </ol> |
| 49 | |
| 50 | <h2 id="generating">Generating a Trace</h2> |
| 51 | |
| 52 | <p>Tracer captures OpenGL ES command execution logs and can also capture progressive images of the |
| 53 | frames generated by those commands to enable you to perform logical and visual analysis of your |
| 54 | OpenGL ES code. The Tracer tool operates by connecting to a device running Android 4.1 (API Level |
| 55 | 16) or higher that is running the application you want to analyze. The Tracer tool captures trace |
| 56 | information while the application is running and saves it to a {@code .gltrace} file for |
| 57 | analysis.</p> |
| 58 | |
| 59 | <img src="{@docRoot}images/gltracer/dialog-trace.png"> |
| 60 | <p class="img-caption"><strong>Figure 1.</strong> Trace capture dialog box.</p> |
| 61 | |
| 62 | <p>To capture an OpenGL ES trace for an Android application:</p> |
| 63 | |
| 64 | <ol> |
| 65 | <li>Connect the Android device using a USB cable and make sure it is enabled for debugging. For |
| 66 | more information, see <a href="{@docRoot}tools/device.html">Using Hardware Devices</a>.</li> |
| 67 | <li>In Eclipse or Device Monitor, activate the <strong>Tracer for OpenGL ES</strong> |
| 68 | perspective.</li> |
| 69 | <li>On the toolbar, click the trace capture button (<img |
| 70 | src="{@docRoot}images/gltracer/icon-capture.png">).</li> |
| 71 | <li>In the dialog box, select the <strong>Device</strong> to use for the trace.</li> |
| 72 | <li>In the <strong>Application Package</strong> field, enter the full application package name |
| 73 | containing the activity you want to trace, for example: {@code com.example.android.opengl}</li> |
| 74 | <li>In the <strong>Activity to launch</strong> field, enter the class name of the activity you |
| 75 | want to trace, for example: {@code OpenGLES20Complete} |
| 76 | <p class="note"><strong>Note:</strong> If you are tracing the default activity for the |
| 77 | application, you can leave this field blank.</p> |
| 78 | </li> |
| 79 | <li>Select the desired <strong>Data Collection Options</strong>. |
| 80 | <p class="note"><strong>Note:</strong> If you want to capture progressive frame images for each |
| 81 | drawing call, enable the <strong>Read back currently bound framebuffer on glDraw*()</strong> option. |
| 82 | Be aware that using this option can result in large trace files.</p> |
| 83 | </li> |
| 84 | <li>Enter a <strong>Destination File</strong> for the trace output.</li> |
| 85 | <li>Click <strong>Trace</strong> to start the trace capture.</li> |
| 86 | <li>On the connected device, exercise the functions of your application you want to trace.</li> |
| 87 | <li>In the dialog box, <strong>Stop Tracing</strong> to complete the tracing run.</li> |
| 88 | </ol> |
| 89 | |
| 90 | <h2 id="analyzing">Analyzing a Trace</h2> |
| 91 | |
| 92 | <p>After you have generated a trace, you can load it for review and analysis.</p> |
| 93 | |
| 94 | <p>To review a captured trace:</p> |
| 95 | |
| 96 | <ol> |
| 97 | <li>In Eclipse or Device Monitor, activate the <strong>Tracer for OpenGL ES</strong> |
| 98 | perspective.</li> |
| 99 | <li>On the toolbar, click the trace load button (<img |
| 100 | src="{@docRoot}images/gltracer/icon-load-trace.png">).</li> |
| 101 | <li>After loading a trace, select a frame and review the OpenGL ES calls. Drawing commands are |
| 102 | highlighted in blue.</li> |
| 103 | </ol> |