I have been trying to measure the app startup time and stumbled across App startup time. It is mentioned here that using logcat with no filters we can see the log ActivityManager: Displayed com.android.myexample/.StartupTiming: +3s534ms (total +1m22s643ms)
. which shows the time taken to launch the process and finish drawing in display corresponding to app.
But, In my case it is not showing.
Here is the screenshot of logcat.
when launching through cmd adb via adb shell am start -S -W com.example.app/.MainActivity
it shows
TotalTime: 554 WaitTime: 558
so here what is TotalTime and WaitTime?
The metric you want is TotalTime, Here's the explanation of both from this blogpost which delves into the complete breakdown of the measurement process in different scenarios:
You may also want to read more about the measurement process directly from the Android Developers documentation. To measure the initial display time, the commands you should use are as follows:
adb [-d|-e|-s <serialNumber>] shell am start -S -W com.android.myexample/.StartupTiming -c android.intent.category.LAUNCHER -a android.intent.action.MAIN
This will give you a sample metric that shows as:
Starting: Intent Activity: com.android.myexample/.StartupTiming ThisTime: 2044 TotalTime: 2044 WaitTime: 2054 Complete