Measure Android app startup time

后端 未结 9 916
Happy的楠姐
Happy的楠姐 2020-12-08 10:35

What is the most precise way to measure startup time of an Android app?

By startup time I mean the difference between 2. and 3. :

  1. The app process is no
相关标签:
9条回答
  • 2020-12-08 11:04

    A simple way to display startup time in android.

    Sometimes the Displayed line in the logcat output contains an additional field for total time. For example:

    ActivityManager: Displayed com.android.myexample/.StartupTiming: +3s534ms (total +1m22s643ms)
    

    In this case, the first time measurement is only for the activity that was first drawn

    Source: Time to initial display

    0 讨论(0)
  • Check in adb shell in below manner.

    adb shell
    adb logcat -b events | grep am_activity_launch_time
    
    [Output]
    01-01 12:32:53.469 1236 1262 I am_activity_launch_time: 
        [0,205360373,com.sec.android.app.clockpackage/.ClockPackage,378,**378**,0]
    
    Remarks:
    Launch time for Clock is 378ms.
    
    0 讨论(0)
  • 2020-12-08 11:12

    Use SysTrace

    Also the Trace class can be used to measure sections using

    Trace.beginSection("name");
    Trace.endSection();
    

    This YouTube video is a quick primer as well.

    0 讨论(0)
提交回复
热议问题