From 25054b8b4abc9e27ccd78efddfbdd8ba0df1b08a Mon Sep 17 00:00:00 2001 From: Vadim Date: Mon, 15 Jan 2024 11:30:03 +0100 Subject: [PATCH] Update documentation (#1) Update documentation: - Add links to blogpost about performance metrics - Elaborate on RenderingMetrics format --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 679f1aa..d7503a2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ Library supports collecting following performance metrics: - App Cold Startup Time - Rendering performance per Activity +We recommend to read our blogpost ["Measuring mobile apps performance in production"](https://medium.com/booking-com-development/measuring-mobile-apps-performance-in-production-726e7e84072f) +first to get some idea on how performance metrics work and why those were chosen. + ### Dependency The library is available on Maven Central: @@ -26,7 +29,7 @@ implementation("com.booking:perfsuite:0.2") ### Collecting Startup Times -Implement the callback invoked once Startup Time is collected: +Implement the callback invoked once [Startup Time](https://medium.com/booking-com-development/measuring-mobile-apps-performance-in-production-726e7e84072f#e383) is collected: ```kotlin class MyStartupTimeListener : AppStartupTimeTracker.Listener { @@ -57,7 +60,8 @@ class MyApplication : Application() { Implement the callback invoked every time when the foreground `Activity` is paused (we can call it "the end of the screen session") and use `RenderingMetricsMapper` to -represent rendering performance metrics in a convenient aggregated format: +represent [rendering performance metrics](https://medium.com/booking-com-development/measuring-mobile-apps-performance-in-production-726e7e84072f#3eca) +in a convenient aggregated format: ```kotlin class MyFrameMetricsListener : ActivityFrameMetricsTracker.Listener { @@ -85,7 +89,17 @@ class MyApplication : Application() { } ``` +As per the code sample above you can use `RenderingMetricsMapper` to collect frames metics in the aggreated format which is convenient for reporting to the backend. +Then metrics will be represented as [`RenderingMetrics`](src/main/java/com/booking/perfsuite/rendering/RenderingMetrics.kt) instance, which will provide data on: +- `totalFrames` - total amount of frames rendered during the screen session +- `totalFreezeTimeMs` - total accumulated time of the UI being frozen during the screen session +- `slowFrames` - amount of [slow frames](https://firebase.google.com/docs/perf-mon/screen-traces?platform=android#slow-rendering-frames) per screens session +- `frozenFrames` - amount of [frozen frames](https://firebase.google.com/docs/perf-mon/screen-traces?platform=android#frozen-frames) per screens session + +Even though we support collecting widely used slow & frozen frames we [strongly recommend relying on `totalFreezeTimeMs` as the main rendering metric](https://medium.com/booking-com-development/measuring-mobile-apps-performance-in-production-726e7e84072f#2d5d) + ## Additional documentation +- [Measuring mobile apps performance in production](https://medium.com/booking-com-development/measuring-mobile-apps-performance-in-production-726e7e84072f) - [App Startup Time documentation by Google](https://developer.android.com/topic/performance/vitals/launch-time) - [Rendering Performance documentation by Google](https://developer.android.com/topic/performance/vitals/render) - [Android Vitals Articles by Pierre Yves Ricau](https://dev.to/pyricau/series/7827)