Home | History | Annotate | Download | only in testing
      1 page.title=
      2 page.image=images/cards/card-test-performance_2x.png
      3 page.keywords=,fps,
      4 
      5 @jd:body
      6 
      7 
      8 <div id="qv-wrapper">
      9   <div id="qv">
     10     <h2></h2>
     11       <ol>
     12         <li><a href="#measure">UI </a>
     13           <ul>
     14             <li><a href="#aggregate"></a></li>
     15             <li><a href="#timing-info"> </a></li>
     16             <li><a href="#timing-dump">  </a></li>
     17             <li><a href="#collection-window"></a></li>
     18             <li><a href="#diagnose"></a></li>
     19             <li><a href="#resources"></a></li>
     20           </ul>
     21         </li>
     22         <li><a href="#automate">UI  </a>
     23           <ul>
     24             <li><a href="#ui-tests">UI </a></li>
     25             <li><a href="#automated-tests"> UI </a></li>
     26             <li><a href="#triage"></a></li>
     27           </ul>
     28         </li>
     29       </ol>
     30   </div>
     31 </div>
     32 
     33 
     34 <p>
     35    UI 60 <a href="https://www.youtube.com/watch?v=CaMTIgxCSqU&index=25&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE">why 60fps?</a><em></em>
     36 
     37 
     38 UI UI 
     39 
     40 
     41 </p>
     42 
     43 
     44 <h2 id="measure">UI </h2>
     45 
     46 <p>
     47   
     48 
     49 
     50 </p>
     51 
     52 <p>
     53   <em><a href="https://source.android.com/devices/tech/debug/dumpsys.html">dumpsys</a></em>   Android 
     54 
     55 <em>gfxinfo</em>  dumpsys  logcat 
     56 
     57 
     58 </p>
     59 
     60 <pre>
     61 &gt; adb shell dumpsys gfxinfo &lt;PACKAGE_NAME&gt;
     62 </pre>
     63 
     64 <p>
     65     
     66 </p>
     67 
     68 <h3 id="aggregate"></h3>
     69 
     70 <p>
     71   M Preview  logcat 
     72 
     73 </p>
     74 
     75 <pre class="noprettyprint">
     76 Stats since: 752958278148ns
     77 Total frames rendered: 82189
     78 Janky frames: 35335 (42.99%)
     79 90th percentile: 34ms
     80 95th percentile: 42ms
     81 99th percentile: 69ms
     82 Number Missed Vsync: 4706
     83 Number High input latency: 142
     84 Number Slow UI thread: 17270
     85 Number Slow bitmap uploads: 1542
     86 Number Slow draw: 23342
     87 </pre>
     88 
     89 <p>
     90   
     91 
     92 </p>
     93 
     94 
     95 <h3 id="timing-info"> </h3>
     96 
     97 <p>
     98   M Preview gfxinfo <em>framestats</em>  
     99 
    100 
    101 </p>
    102 
    103 <pre>
    104 &gt;adb shell dumpsys gfxinfo &lt;PACKAGE_NAME&gt; framestats
    105 </pre>
    106 
    107 <p>
    108    120  adb dumpsys gfxinfo
    109   &lt;PACKAGE_NAME&gt; framestats 
    110 
    111 </p>
    112 
    113 <pre class="noprettyprint">
    114 0,49762224585003,49762241251670,9223372036854775807,0,49762257627204,49762257646058,49762257969704,49762258002100,49762265541631,49762273951162,49762300914808,49762303675954,
    115 0,49762445152142,49762445152142,9223372036854775807,0,49762446678818,49762446705589,49762447268818,49762447388037,49762453551527,49762457134131,49762474889027,49762476150120,
    116 0,49762462118845,49762462118845,9223372036854775807,0,49762462595381,49762462619287,49762462919964,49762462968454,49762476194547,49762476483454,49762480214964,49762480911527,
    117 0,49762479085548,49762479085548,9223372036854775807,0,49762480066370,49762480099339,49762481013089,49762481085850,49762482232152,49762482478350,49762485657620,49762486116683,
    118 </pre>
    119 
    120 <p>
    121    1 
    122 
    123 
    124 </p>
    125 
    126 
    127 <h4 id="fs-data-format">Framestats </h4>
    128 
    129 <p>
    130    CSV  
    131 
    132 
    133 </p>
    134 
    135 <ul>
    136   <li>FLAGS
    137     <ul>
    138       <li>FLAGS 0FRAME_COMPLETED  INTENDED_VSYNC 
    139 
    140       </li>
    141 
    142       <li>FLAGS 0 16 
    143 
    144 
    145         <ul>
    146           <li>
    147 
    148           </li>
    149 
    150           <li>
    151  60 fps 
    152 
    153 
    154           </li>
    155         </ul>
    156       </li>
    157     </ul>
    158   </li>
    159 
    160   <li>INTENDED_VSYNC
    161     <ul>
    162       <li> VSYNC vsync  UI 
    163 
    164 
    165       </li>
    166     </ul>
    167   </li>
    168 
    169   <li>VSYNC
    170     <ul>
    171       <li> vsync Choreographer  View.getDrawingTime() 
    172 
    173       </li>
    174 
    175       <li>VSYNC  VSYNC <a href="https://www.youtube.com/watch?v=1iaHxmfZGGc&list=PLOU2XLYxmsIKEOXh5TwZEv89aofHzNCiu&index=23">Understanding VSYNC</a> 
    176 
    177 
    178       </li>
    179     </ul>
    180   </li>
    181 
    182   <li>OLDEST_INPUT_EVENT
    183     <ul>
    184       <li>Long.MAX_VALUE
    185 
    186       </li>
    187 
    188       <li>
    189 
    190       </li>
    191     </ul>
    192   </li>
    193 
    194   <li>NEWEST_INPUT_EVENT
    195     <ul>
    196       <li>0
    197 
    198       </li>
    199 
    200       <li>
    201 
    202       </li>
    203 
    204       <li>FRAME_COMPLETED  NEWEST_INPUT_EVENT 
    205 
    206       </li>
    207     </ul>
    208   </li>
    209 
    210   <li>HANDLE_INPUT_START
    211     <ul>
    212       <li>
    213       </li>
    214 
    215       <li> ANIMATION_START 
    216 
    217       </li>
    218 
    219       <li>&gt; 2 View.onTouchEvent() 
    220 
    221  
    222 
    223 
    224       </li>
    225     </ul>
    226   </li>
    227 
    228   <li>ANIMATION_START
    229     <ul>
    230       <li>Choreographer 
    231       </li>
    232 
    233       <li> PERFORM_TRANVERSALS_START ObjectAnimatorViewPropertyAnimator Transitions
    234 
    235 
    236       </li>
    237 
    238       <li>&gt; 2   ObjectAnimators 
    239 
    240 
    241       </li>
    242 
    243       <li>Choreographer <a href="https://developers.google.com/events/io/sessions/325418001">For Butter or Worse</a> 
    244 
    245       </li>
    246     </ul>
    247   </li>
    248 
    249   <li>PERFORM_TRAVERSALS_START
    250     <ul>
    251       <li> DRAW_START 
    252 
    253 
    254       </li>
    255 
    256       <li> <a href="https://www.youtube.com/watch?v=we6poP0kw6E&list=PLOU2XLYxmsIKEOXh5TwZEv89aofHzNCiu&index=27">Invalidations, Layouts and Performance</a> 
    257 
    258 
    259       </li>
    260     </ul>
    261   </li>
    262 
    263   <li>DRAW_START
    264     <ul>
    265       <li>performTraversals  
    266 
    267       </li>
    268 
    269       <li> SYNC_START  View.draw() 
    270 
    271       </li>
    272 
    273       <li><a href="{@docRoot}guide/topics/graphics/hardware-accel.html#hardware-model">Hardware Acceleration</a>  <a href="https://www.youtube.com/watch?v=we6poP0kw6E&list=PLOU2XLYxmsIKEOXh5TwZEv89aofHzNCiu&index=27">Invalidations, Layouts and Performance</a> 
    274 
    275 
    276       </li>
    277     </ul>
    278   </li>
    279 
    280   <li>SYNC_START
    281     <ul>
    282       <li>
    283       </li>
    284 
    285       <li> ISSUE_DRAW_COMMANDS_START &gt; 0.4 GPU  Bitmaps 
    286 
    287 
    288       </li>
    289 
    290       <li><a href="https://www.youtube.com/watch?v=VzYkVL1n4M8&index=24&list=PLOU2XLYxmsIKEOXh5TwZEv89aofHzNCiu">Profile GPU Rendering</a> 
    291 
    292       </li>
    293     </ul>
    294   </li>
    295 
    296   <li>ISSUE_DRAW_COMMANDS_START
    297     <ul>
    298       <li> GPU 
    299       </li>
    300 
    301       <li> FRAME_COMPLETED  GPU 
    302 
    303 
    304       </li>
    305     </ul>
    306   </li>
    307 
    308   <li>SWAP_BUFFERS
    309     <ul>
    310       <li>eglSwapBuffers 
    311 
    312       </li>
    313     </ul>
    314   </li>
    315 
    316   <li>FRAME_COMPLETED
    317     <ul>
    318       <li>FRAME_COMPLETED  INTENDED_VSYNC 
    319 
    320       </li>
    321     </ul>
    322   </li>
    323 
    324 </ul>
    325 
    326 <p>
    327   FRAME_COMPLETED - INTENDED_VSYNC
    328 
    329  16 
    330 
    331 
    332 
    333 
    334 
    335 </p>
    336 
    337 <img src="{@docRoot}preview/images/perf-test-framestats.png">
    338 
    339 
    340 <h3 id="timing-dump">  </h3>
    341 
    342 <p>
    343   []  [<strong>GPU</strong>]  [<strong>adb shell dumpsys gfxinfo</strong>] <code>adb shell dumpsys gfxinfo</code>  120 
    344 
    345 
    346 
    347 
    348 </p>
    349 
    350 <p>
    351    <a href="#fs-data-format">framestats</a>  
    352 
    353 
    354 
    355 </p>
    356 
    357 <img src="{@docRoot}preview/images/perf-test-frame-latency.png">
    358 
    359 <p>
    360   gfxinfo  
    361 
    362 </p>
    363 
    364 <p>
    365    1 
    366  
    367 
    368  <a href="https://www.youtube.com/watch?v=we6poP0kw6E&index=27&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE">Invalidations, Layouts and Performance</a> 
    369 
    370 
    371 </p>
    372 
    373 
    374 <h3 id="collection-window"></h3>
    375 
    376 <p>
    377   Framestats   2 
    378  
    379 
    380 
    381 </p>
    382 
    383 <pre>
    384 &gt;adb shell dumpsys gfxinfo &lt;PACKAGE_NAME&gt; reset
    385 </pre>
    386 
    387 <p>
    388     2 
    389 
    390 
    391 </p>
    392 
    393 
    394 <h3 id="diagnose"></h3>
    395 
    396 <p>
    397   
    398 dumpsys 
    399 
    400 <a href="{@docRoot}tools/help/systrace.html">systrace</a> 
    401 
    402 </p>
    403 
    404 
    405 <h3 id="resources"></h3>
    406 
    407 <p>
    408   Android  
    409 
    410 
    411 </p>
    412 
    413 <ul>
    414   <li>Rendering Performance 101
    415   </li>
    416   <li>Why 60fps?
    417   </li>
    418   <li>Android UI and the GPU
    419   </li>
    420   <li>Invalidations Layouts and performance
    421   </li>
    422   <li>Analyzing UI Performance with Systrace
    423   </li>
    424 </ul>
    425 
    426 
    427 <h2 id="automate">UI  </h2>
    428 
    429 <p>
    430   UI  1 
    431 
    432 
    433 
    434 
    435 </p>
    436 
    437 <p>
    438    UI 
    439 Android M Developer Preview 
    440 
    441 
    442 
    443 </p>
    444 
    445 <p>
    446    
    447 
    448 </p>
    449 
    450 <p>
    451    2 
    452 
    453 
    454 </p>
    455 
    456 
    457 <h3 id="ui-tests">UI </h3>
    458 
    459 <p>
    460   
    461 
    462 </p>
    463 
    464 <h4>
    465   
    466 </h4>
    467 
    468 <p>
    469   
    470  UI 
    471 
    472 
    473 </p>
    474 
    475 <ul>
    476   <li> ListView  RecyclerView 
    477   </li>
    478 
    479   <li>
    480   </li>
    481 
    482   <li>
    483   </li>
    484 
    485   <li>
    486   </li>
    487 
    488   <li>
    489   </li>
    490 </ul>
    491 
    492 <p>
    493    
    494 
    495 </p>
    496 
    497 <h4>
    498   
    499 </h4>
    500 
    501 <p>
    502   
    503 
    504 </p>
    505 
    506 <ul>
    507   <li> UI 
    508   </li>
    509 
    510   <li>
    511   </li>
    512 
    513   <li> 90%  98 % 
    514   </li>
    515 
    516   <li> 98% 
    517   </li>
    518 
    519   <li>
    520   </li>
    521 </ul>
    522 
    523 <p>
    524    
    525 
    526 </p>
    527 
    528 <h4>
    529   
    530 </h4>
    531 
    532 <p>
    533   GPU CPU 
    534 
    535 
    536 
    537 
    538  CPU RAM
    539 
    540 
    541 </p>
    542 
    543 <h4>
    544   UI 
    545 </h4>
    546 
    547 <p>
    548   <a href="{@docRoot}training/testing/ui-testing/uiautomator-testing.html">UI Automator</a>  <a href="{@docRoot}training/testing/ui-testing/espresso-testing.html">Espresso</a> 
    549 
    550 
    551  
    552 
    553 
    554 </p>
    555 
    556 <p>
    557   <code>dumpsys gfxinfo</code> 
    558 
    559 
    560 </p>
    561 
    562 
    563 <h3 id="automated-tests"> UI </h3>
    564 
    565 <p>
    566   UI 1  
    567 
    568 
    569 
    570 </p>
    571 
    572 <h4>
    573   
    574 </h4>
    575 
    576 <p>
    577   UI <a href="{@docRoot}training/testing/ui-testing/uiautomator-testing.html">UI Automator</a> 
    578 <em>dumpsys gfxinfo</em>  ADB 
    579 <a href="{@docRoot}tools/help/monkeyrunner_concepts.html">MonkeyRunner</a>  
    580 
    581 
    582 
    583 </p>
    584 
    585 <p>
    586   UI   MonkeyRunner 
    587 
    588 </p>
    589 
    590 <ul>
    591   <li>1  APK 
    592   </li>
    593 
    594   <li>UI Automator UI 
    595   </li>
    596 
    597   <li><em>dumpsys gfxinfo</em><em></em>
    598   </li>
    599 
    600   <li>
    601   </li>
    602 </ul>
    603 
    604 
    605 <h3 id="triage"></h3>
    606 
    607 <p>
    608   
    609  
    610 
    611 
    612  <a href="{@docRoot}tools/help/systrace.html">systrace</a> systrace   
    613 
    614 
    615 </p>
    616 
    617 <h4>
    618   
    619 </h4>
    620 
    621 <p>
    622    
    623 
    624 
    625  2 
    626 
    627 
    628 </p>
    629 
    630 <p>
    631   
    632 
    633 
    634 
    635 </p>
    636 
    637 <p>
    638   
    639 WRT 
    640 
    641 
    642 </p>
    643 
    644 <p>
    645    UI 
    646 
    647 
    648 
    649 
    650 </p>
    651 
    652 <p>
    653    10 50  100 
    654 
    655 
    656 </p>
    657