stopTracingAndDownloadTimeline method

Future<Timeline> stopTracingAndDownloadTimeline ({Duration timeout: _kUnusuallyLongTimeout })

Stops recording performance traces and downloads the timeline.

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.

Implementation

Future<Timeline> stopTracingAndDownloadTimeline({
  Duration timeout = _kUnusuallyLongTimeout,
}) async {
  assert(timeout != null);
  try {
    await _warnIfSlow<void>(
      future: _peer.sendRequest(_setVMTimelineFlagsMethodName, <String, String>{'recordedStreams': '[]'}),
      timeout: timeout,
      message: 'VM is taking an unusually long time to respond to being told to stop tracing...',
    );
    return Timeline.fromJson(await _peer.sendRequest(_getVMTimelineMethodName));
  } catch (error, stackTrace) {
    throw DriverError(
      'Failed to stop tracing due to remote error',
      error,
      stackTrace,
    );
  }
}