startTracing method

  1. @override
Future<void> startTracing(
  1. {List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
  2. Duration timeout = kUnusuallyLongTimeout}
)
override

Starts recording performance traces.

The timeout argument causes a warning to be displayed to the user if the operation exceeds the specified timeout; it does not actually cancel the operation.

For WebFlutterDriver, this is only supported for Chrome.

Implementation

@override
Future<void> startTracing({
  List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
  Duration timeout = kUnusuallyLongTimeout,
}) async {
  assert(streams.isNotEmpty);
  try {
    await _warnIfSlow<vms.Success>(
      future: _serviceClient.setVMTimelineFlags(
        _timelineStreamsToString(streams),
      ),
      timeout: timeout,
      message: 'VM is taking an unusually long time to respond to being told to start tracing...',
    );
  } catch (error, stackTrace) {
    throw DriverError(
      'Failed to start tracing due to remote error',
      error,
      stackTrace,
    );
  }
}