FrameTimingDetector constructor
FrameTimingDetector({
- int? warningThresholdMs,
- int? criticalThresholdMs,
- int fpsTarget = 60,
- int warmupFrameCount = 0,
- Duration warmupDuration = _defaultWarmupDuration,
- bool captureMode = false,
- int startupPhaseWindowSeconds = 5,
- void onFrameStats(
- FrameStatsBuffer buffer
- void onFrame(
- FrameStats frame
- String? sourceRouteProvider()?,
- int? appStartMonotonicUsForTest()?,
- int ownWorkOverlapUs()?,
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)',
);