CockpitDevToolsProfile constructor

CockpitDevToolsProfile({
  1. required String source,
  2. required String state,
  3. String? reason,
  4. CockpitCpuProfile? cpu,
  5. CockpitHeapProfile? heap,
  6. CockpitGcProfile? gc,
  7. CockpitGpuProfile? gpu,
  8. CockpitIsolateProfile? isolate,
  9. CockpitTimelineProfile? timeline,
  10. CockpitDisplayProfile? display,
  11. CockpitRebuildProfile? rebuild,
  12. CockpitVmRuntimeProfile? vm,
  13. CockpitVmMemoryProfile? vmMemory,
  14. Iterable<CockpitAllocationTrace> allocationTraces = const <CockpitAllocationTrace>[],
  15. Iterable<CockpitVmLogEvent> logs = const <CockpitVmLogEvent>[],
  16. Iterable<CockpitVmDebugEvent> debug = const <CockpitVmDebugEvent>[],
  17. int droppedLogs = 0,
  18. int droppedDebug = 0,
  19. CockpitPerfettoProfile? perfetto,
})

Implementation

CockpitDevToolsProfile({
  required this.source,
  required this.state,
  this.reason,
  this.cpu,
  this.heap,
  this.gc,
  this.gpu,
  this.isolate,
  this.timeline,
  this.display,
  this.rebuild,
  this.vm,
  this.vmMemory,
  Iterable<CockpitAllocationTrace> allocationTraces =
      const <CockpitAllocationTrace>[],
  Iterable<CockpitVmLogEvent> logs = const <CockpitVmLogEvent>[],
  Iterable<CockpitVmDebugEvent> debug = const <CockpitVmDebugEvent>[],
  this.droppedLogs = 0,
  this.droppedDebug = 0,
  this.perfetto,
}) : allocationTraces = List<CockpitAllocationTrace>.unmodifiable(
       allocationTraces,
     ),
     logs = List<CockpitVmLogEvent>.unmodifiable(logs),
     debug = List<CockpitVmDebugEvent>.unmodifiable(debug) {
  if (source.trim().isEmpty || state.trim().isEmpty) {
    throw const FormatException('DevTools profile identity is invalid.');
  }
  if (reason != null && reason!.trim().isEmpty) {
    throw const FormatException('DevTools profile reason is invalid.');
  }
  if (this.allocationTraces.length > 20) {
    throw const FormatException('Allocation trace count is bounded.');
  }
  if (this.logs.length > 2000 || this.debug.length > 2000) {
    throw const FormatException('VM event count is bounded.');
  }
  if (droppedLogs < 0 || droppedDebug < 0) {
    throw const FormatException('VM event drop counts are invalid.');
  }
}