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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPING.md
+1-87Lines changed: 1 addition & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -457,90 +457,4 @@ And then update the Mapbox Maps SDK's version name to the snapshot version in yo
457
457
458
458
## Working with traces
459
459
460
-
Mapbox Maps SDK for Android allows enabling additional Mapbox traces that could be of help troubleshooting performance issues.
461
-
Working with traces is possible only when app is debuggable:
462
-
463
-
```xml
464
-
<application>
465
-
...
466
-
android:debuggable="true"
467
-
...
468
-
</application>
469
-
```
470
-
471
-
If the app is not debuggable and `MapboxTracing` will be used - runtime exception will be thrown.
472
-
473
-
### Enabling Mapbox traces
474
-
475
-
There are 2 types of traces that could be enabled:
476
-
- Native rendering engine traces could be enabled with `MapboxTracing.enableCore()`. Those traces include native render calls, style loading, requesting tiles and more.
477
-
- Android platform traces could be enabled with `MapboxTracing.enablePlatform()`. Those traces include Android render thread calls such as preparing / destroying surface.
478
-
479
-
It is also possible to enable all the traces with `MapboxTracing.enableAll()`. Tracing could be disabled with `MapboxTracing.disableAll()`.
480
-
481
-
### Recording traces using Perfetto UI
482
-
483
-
The Perfetto Record settings can be edited when recording a new trace from [ui.perfetto.dev](https://ui.perfetto.dev/#!/record).
484
-
We recommend to enable the following options in Perfetto and combine them with `MapboxTracing.enableAll()` enabled in application code:
485
-
486
-
In **GPU** section. Enable `GPU frequency`, `GPU memory` and `GPU work period`:
Please make sure the “Atrace userspace annotations” is selected and “Record events from all Android apps and services” is enabled (it is also required to record the Mapbox trace annotations).
Produced html file can be opened in https://ui.perfetto.dev viewer.
509
-
510
-
511
-
### Recording traces using Android studio
512
-
513
-
There are several ways of capturing traces for Android which are described in [official documentation](https://developer.android.com/topic/performance/tracing). As a reference we will describe the steps of recording traces using Android Studio Profiler:
514
-
515
-
1. Run your app in profile mode e.g. by clicking following icon in Android Studio.
2. When app is run, click on CPU in Profiler window and select `System Trace` radio-button. When you are ready to actually record the traces, hit the `Record` button.
3. When you are done with recording, press `Stop` button, wait Android Studio to parse your traces and hit `Export system trace recording` to save trace recording locally.
After we exported trace recording we could use [Perfetto](https://ui.perfetto.dev/) to investigate the Mapbox traces.
527
-
528
-
1. Open [Perfetto](https://ui.perfetto.dev/) and drag-and-drop your local trace recording file there.
529
-
2. When it is loaded - navigate to your application package and un-squash it.
530
-
3. Mapbox native render engine traces added by `MapboxTracing.enableCore()` could be found at the bottom of your app process in separate groups. Those traces start with `mbx:`.
4. Mapbox platform specific traces will be located inside other Android threads and not in dedicated groups, so you could use global search by `mbx:` to locate them.
#### Using command line utility (/Library/Android/sdk/platform-tools/systrace)
545
-
546
-
`python systrace.py -a "com.mapbox.maps.testapp" -o trace.html -b 20000`
460
+
If you're experiencing performance problems, enabling and analyzing traces is a crucial step for diagnosis. For step-by-step instructions on how to enable tracing and interpret the collected data, please consult the [tracing guide](https://docs.mapbox.com/android/maps/guides/debugging-and-profiling/tracing/).
0 commit comments