Mobile Development 7 min read

Measuring Android App Startup Time: ADB Commands, Screen Recording, and Code Instrumentation

Android applications often suffer from high battery drain, slow launches, and UI lag, so this article explains three practical methods—using ADB commands, screenrecord video analysis, and code instrumentation—to measure and analyze app startup time, with detailed steps, interpretation of timing metrics, and visual examples.

Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Intelligent Testing
Measuring Android App Startup Time: ADB Commands, Screen Recording, and Code Instrumentation

Android users frequently encounter problems such as rapid battery drain, slow app launches, increasing lag during use, and low frame rates, making performance testing essential to maintain a good user experience.

Performance testing for Android apps typically covers launch time, memory, CPU, power consumption, network traffic, and smoothness; this article focuses on measuring launch time.

Launch time is divided into cold start (no existing app process) and hot start (app brought to foreground). QA usually concentrates on cold start duration.

Method 1.1: Using ADB command The command adb shell am start -W packagename/MainActivity reports timing metrics. Important fields include TotalTime (overall app start time, usually the metric of interest), WaitTime (includes previous activity pause time), and ThisTime (time for the last Activity in the launch chain). Images illustrate the output and explain the differences.

While this method provides a quick measurement, it only captures the time from activity start to layout/draw completion, does not reflect the full user‑perceived launch time, and lacks per‑function breakdown.

Method 1.2: Using screenrecord Execute adb shell screenrecord --bugreport /sdcard/lanch.mp4 --bugreport to record a video with embedded timestamps and frame information. After the app fully launches, stop recording with Ctrl+C , pull the video via adb pull /sdcard/lanch.mp4 ./ , and play it frame‑by‑frame (e.g., with QuickTime or KMPlayer). By noting the frame when the app icon lights up (click time) and the frame when the launch screen finishes drawing, the perceived startup time can be calculated.

This approach mimics real user interaction but is labor‑intensive and does not directly reveal which functions consume time.

Method 1.3: Code instrumentation (logging) Insert log points in the code to output timestamps for each stage of the launch process. The article provides example screenshots of the logged output, showing total and per‑function durations. This method enables QA to pinpoint slow functions, such as plugin initialization, and is considered the most effective for detailed analysis.

Overall, code instrumentation offers clear visibility into each Activity’s total and individual function costs, facilitating precise performance optimization.

Next preview: The upcoming article will cover memory and CPU profiling using ADB commands, Android Studio built‑in tools, and the ActivityManager.MemoryInfo() API.

mobile developmentInstrumentationAndroidPerformance Testingstartup-timeADBScreen Recording
Baidu Intelligent Testing
Written by

Baidu Intelligent Testing

Welcome to follow.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.