FrameTimingDetector constructor

FrameTimingDetector({
  1. int? warningThresholdMs,
  2. int? criticalThresholdMs,
  3. int fpsTarget = 60,
  4. int warmupFrameCount = 0,
  5. Duration warmupDuration = _defaultWarmupDuration,
  6. bool captureMode = false,
  7. int startupPhaseWindowSeconds = 5,
  8. void onFrameStats(
    1. FrameStatsBuffer buffer
    )?,
  9. void onFrame(
    1. FrameStats frame
    )?,
  10. String? sourceRouteProvider()?,
  11. int? appStartMonotonicUsForTest()?,
  12. int ownWorkOverlapUs(
    1. int fromUs,
    2. int toUs
    )?,
})

Implementation

FrameTimingDetector({
  int? warningThresholdMs,
  int? criticalThresholdMs,
  this.fpsTarget = 60,
  this.warmupFrameCount = 0,
  this.warmupDuration = _defaultWarmupDuration,
  this.captureMode = false,
  this.startupPhaseWindowSeconds = 5,
  this.onFrameStats,
  this.onFrame,
  String? Function()? sourceRouteProvider,
  int? Function()? appStartMonotonicUsForTest,
  int Function(int fromUs, int toUs)? ownWorkOverlapUs,
}) : _sourceRouteProvider = sourceRouteProvider ?? (() => null),
     _ownWorkOverlapUs = ownWorkOverlapUs ?? ownWorkLog.overlapUs,
     warningBudgetUs = warningThresholdMs != null
         ? warningThresholdMs * 1000
         : _budgetUsFromFpsTarget(fpsTarget),
     criticalBudgetUs = criticalThresholdMs != null
         ? criticalThresholdMs * 1000
         : (warningThresholdMs != null
                   ? warningThresholdMs * 1000
                   : _budgetUsFromFpsTarget(fpsTarget)) *
               2,
     _explicitThresholds =
         warningThresholdMs != null || criticalThresholdMs != null,
     _appStartForTest = appStartMonotonicUsForTest,
     super(
       type: DetectorType.frameTiming,
       lifecycle: DetectorLifecycle.runtime,
       name: 'Frame Timing',
       description:
           'Detects jank frames against the frame budget '
           '(${warningThresholdMs ?? _budgetUsFromFpsTarget(fpsTarget) ~/ 1000}ms)',
     );