startTracing method

Future<void> startTracing ({List<TimelineStream> streams: _defaultStreams, Duration timeout: _kUnusuallyLongTimeout })

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.


Future<void> startTracing({
  List<TimelineStream> streams = _defaultStreams,
  Duration timeout = _kUnusuallyLongTimeout,
}) async {
  assert(streams != null && streams.isNotEmpty);
  assert(timeout != null);
  try {
    await _warnIfSlow<void>(
      future: _peer.sendRequest(_setVMTimelineFlagsMethodName, <String, String>{
        'recordedStreams': _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',