Home | History | Annotate | Download | only in systrace
      1 page.title=Systrace Walkthrough
      2 meta.tags="android, performance, profiling, tools, compute, systrace"
      3 page.tags="android", "performance", "profiling", "tools", "compute", "systrace"
      4 page.metaDescription=Collect system and application process execution data to identify performance bottlenecks.
      5 page.image=tools/performance/thumbnails/tools_systrace.png
      6 page.article=true
      7 
      8 @jd:body
      9 
     10 <style>
     11   .no-bullet {
     12     list-style-type: none;
     13   }
     14   .padded {
     15     padding-left: 10px;
     16   }
     17 </style>
     18 
     19 <div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
     20 
     21 <h2>In this document</h2>
     22 <ul>
     23   <li><a href="#WhatYouNeed">Prerequisites</a></li>
     24   <li><a href="#WorkingWithSystrace">Working with Systrace</a></li>
     25 </ul>
     26 
     27 <h2>You should also read</h2>
     28 <ul>
     29   <li><a href="{@docRoot}tools/performance/traceview/index.html">
     30     Traceview Walkthrough</a></li>
     31     <li><a href="{@docRoot}tools/performance/allocation-tracker/index.html">
     32     Allocation Tracker Walkthrough</a></li>
     33 </ul>
     34 
     35 </div>
     36 
     37   <p>This walkthrough shows the basic usage and workflow for the Systrace tool in the Android
     38   Device Monitor.</p>
     39 
     40   <p>Systrace collects system and application process execution data and generates detailed,
     41   interactive reports from devices running Android 4.1 and higher.</p>
     42 
     43   <p>What it's good for:</p>
     44 
     45   <ul>
     46     <li>Evaluating container performance.</li>
     47 
     48     <li>Finding performance bottlenecks in the execution of your code.</li>
     49   </ul>
     50 
     51   <h2 id="WhatYouNeed">Prerequisites</h2>
     52 
     53   <ul>
     54     <li>Android SDK Tools 20.</li>
     55 
     56     <li><a href="http://www.python.org/">Python</a> installed and included in your development
     57     computer's execution path.</li>
     58 
     59     <li>A mobile device running at least Android 4.1 with <a href=
     60     "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
     61     and USB Debugging enabled in Developer Options.</li>
     62 
     63     <li>Application code. Use your own code, or the <a href=
     64     "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
     65     "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
     66   </ul>
     67 
     68   <h2 id="WorkingWithSystrace">Working with Systrace</h2>
     69 
     70 <ul class="no-bullet">
     71 <!-- this also hides bullet, by default outside box -->
     72  <li><div style="overflow:hidden">
     73   <ol class="padded">
     74 
     75     <div class="figure" style="">
     76       <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image001.png"
     77          alt=""
     78          width="400px" />
     79       <p class="img-caption">
     80         <strong>Figure 1. </strong>Starting Android Device Monitor.
     81       </p>
     82     </div>
     83 
     84     <li>Connect your mobile device to your computer.</li>
     85 
     86     <li>Open your application in Android Studio, build the source, and run it on your device.</li>
     87 
     88     <li>From Android Studio, start the Android Device Monitor: <b>Tools -&gt; Android -&gt; Android
     89     Device</b> <b>Monitor</b>.
     90 
     91 </ol>
     92 </div></li>
     93 
     94 <li><div style="overflow:hidden">
     95 <hr>
     96   <ol class="padded" start="4">
     97 
     98     <div class="figure" style="">
     99       <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image003.png"
    100          alt=""
    101          width="400px" />
    102       <p class="img-caption">
    103         <strong>Figure 2. </strong>Steps for starting Systrace.
    104       </p>
    105     </div>
    106 
    107     <li>Make sure your
    108       device and the package for your application are showing in the Devices (DDMS mode) or
    109       Windows (Hierarchy Viewer mode) tab.
    110 
    111       <p>You can choose <b>Window &gt; Reset Perspective</b> to
    112       get back to the default arrangement.</p>
    113     </li>
    114 
    115     <li>Click the <b>DDMS</b> button, because Systrace is one of the DDMS tools.</li>
    116 
    117     <li>Click the <b>Systrace</b> button
    118       <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image002.png">.</li>
    119 </ol>
    120 </div></li>
    121 
    122 <li><div style="overflow:hidden">
    123 <hr>
    124   <ol class="padded" start="7">
    125 
    126     <div class="figure" style="">
    127       <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image004.png"
    128          alt=""
    129          width="400px" />
    130       <p class="img-caption">
    131        <strong>Figure 3. </strong>Steps for creating a trace.
    132       </p>
    133     </div>
    134 
    135     <li>In the <b>Android System Trace</b> popup, choose your settings for the trace.
    136 
    137       <ul>
    138         <li><b>Destination File:</b> Where the trace is stored as an HTML file. Default is in
    139         your home directory as <code>trace.html</code>.</li>
    140 
    141         <li><b>Trace Duration:</b> Default is 5 seconds,
    142           and 30 seconds is a good time to choose.</li>
    143 
    144         <li><b>Trace Buffer size:</b> Default is unlimited.</li>
    145 
    146         <li><b>Enable Application Traces from:</b> Make sure your app is selected.</li>
    147 
    148         <li><b>Select tags to enable:</b> Choose at least one value to trace, for example Graphics
    149         and View System.</li>
    150       </ul>
    151     </li>
    152 
    153     <li>Click <b>OK</b> to start tracing.</li>
    154 
    155     <li>Interact with your app.</li>
    156 </ol>
    157 </div></li>
    158 
    159 <li><div style="overflow:hidden">
    160 <hr>
    161   <ol class="padded" start="10">
    162 
    163     <div class="figure" style="">
    164       <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image005.png"
    165          alt=""
    166          width="400px" />
    167       <p class="img-caption">
    168         <strong>Figure 4. </strong>Example systrace output in browser.
    169       </p>
    170     </div>
    171 
    172     <li>When the trace is done, you are automatically returned to Android Device Monitor.</li>
    173 
    174     <li>Go to your home directory, or the directory you chose as the file destination.</li>
    175 
    176     <li>Open the <code>trace.html</code> file in your browser.</li>
    177 
    178    </ol>
    179 </div></li>
    180 </ul>
    181 
    182 
    183