Skip to content

Commit

Permalink
Update documentation (#1)
Browse files Browse the repository at this point in the history
Update documentation:

- Add links to blogpost about performance metrics
- Elaborate on RenderingMetrics format
  • Loading branch information
smbduknow authored Jan 15, 2024
1 parent eac5f2f commit 25054b8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 25054b8

Please sign in to comment.