Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Activity lifecycle metrics
Clone this wiki locally
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 -
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 (
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: http://graphics-geek.blogspot.com/2015/10/measuring-activity-startup-time.html