startPerformanceStatisticsCollection method
- PerformanceStatisticsOptions options,
- PerformanceStatisticsListener listener
Collects CPU and GPU resource usage, as well as timings of layers and rendering groups, over a user-configurable sampling duration. Use the collected information to identify layers or rendering groups that may be performing poorly.
Use PerformanceStatisticsOptions to configure the following collection behaviours:
- Which types of sampling to perform, whether cumulative, per-frame, or both.
- Duration of sampling in milliseconds. A value of 0 forces the collection of performance statistics every frame.
The statistics collection can be canceled by calling stopPerformanceStatisticsCollection. Canceling collection will prevent the listener callback from being called. Collection can be restarted by calling startPerformanceStatisticsCollection again.
The callback function will be called every time the configured sampling duration PerformanceStatisticsOptions.samplingDurationMillis has elapsed.
- Parameters:
- options The statistics collection options to collect.
- callback The callback to be invoked when performance statistics are available.
Enable real-time collection of map rendering performance statistics, for development purposes. Use after
render()has been called for the first time.
Collects CPU, GPU resource usage and timings of layers and rendering groups over a user-configurable sampling duration. Use the collected information to find which layers or rendering groups might be performing poorly. Use PerformanceStatisticsOptions to configure the following statistics collection behaviors:
- Specify the types of sampling: cumulative, per-frame, or both.
- Define the minimum amount of time over which to perform sampling.
Utilize PerformanceStatisticsListener to observe the collected performance statistics. The callback function is invoked after the configured sampling duration has elapsed. The collection process is continuous; without user-input, it restarts after each callback invocation. Note: Specifying a negative sampling duration or omitting the callback function will result in no operation, which will be logged for visibility.
In order to stop the collection process, call stopPerformanceStatisticsCollection. After calling startPerformanceStatisticsCollection, stopPerformanceStatisticsCollection must be called before collection can be restarted.
Implementation
@experimental
void startPerformanceStatisticsCollection(
PerformanceStatisticsOptions options,
PerformanceStatisticsListener listener) {
PerformanceStatisticsListener.setUp(listener,
binaryMessenger: _mapboxMapsPlatform.binaryMessenger,
messageChannelSuffix: _mapboxMapsPlatform.channelSuffix.toString());
_performanceStatistics.startPerformanceStatisticsCollection(options);
}