startPerformance method
Future<CockpitPerformanceCaptureSession>
startPerformance(
- CockpitPerformanceCaptureRequest request
Implementation
Future<CockpitPerformanceCaptureSession> startPerformance(
CockpitPerformanceCaptureRequest request,
) async {
if (_performanceStarting ||
_recordingStarting ||
_activePerformanceSession != null ||
performanceCollector.isRunning) {
throw StateError('A performance capture is already active.');
}
if (_activeRecordingSession != null) {
throw StateError(
'Performance capture cannot overlap a screen recording.',
);
}
_performanceStarting = true;
try {
performanceCollector.start(mode: request.mode);
final startedAt = performanceCollector.startedAt;
if (startedAt == null) {
performanceCollector.dispose();
throw StateError('Performance capture did not report a start time.');
}
final session = CockpitPerformanceCaptureSession(
request: request,
startedAt: startedAt,
buildMode: performanceCollector.buildMode,
);
_activePerformanceSession = session;
return session;
} finally {
_performanceStarting = false;
}
}