Activity lifecycle metrics

Mirosław Stanek edited this page Mar 1, 2016 · 1 revision

AndroidDevMetrics measures how performant are Activity lifecycle methods in your app. It can give you information how much time was needed to open new Activity (or Application if it was launch screen) and where are possible bottlenecks.


Lifecycle methods and frame drops

Activity lifecycle methods - onCreate(), onStart(), onResume() are measured based on app calls (if app overrides those methods) and on ActivityLifecycleCallbacks. In addition metrics give you information how much time it took to show user interface for particular Activity (Window focus gained).

Frame drops are measured by Choreographer (by default max limit for frame drop is 40fps - you can change it in AndroidDevMetrics.Builder). Each Activity collects informations about dropped frames count and average fps for collected drops.

Why overall measured time is smaller than presented in Logcat's I/ActivityManager: Displayed Activity: +__ms

AndroidDevMetrics measures time of lifecycle methods (onCreate(), onStart(), onResume()) executed mostly on app-side code. ActivityManager measures overall time from startActivity request to its display, using internal framework features.

Even without hidden framework features time measured by AndroidDevMetrics can be meaningful because it shows execution time which can be affected by you - the non-platform developer. What about the rest? Well, it's Googlers job to optimize internal code. 😉

Here you can find more details about ActivityManager and measuring activity startup time:

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.