debugFrameCounts method
Implementation
Map<String, int> debugFrameCounts(Timeline timeline) {
int uiAsync = 0, uiSync = 0, rasterCount = 0;
final total = timeline.traceEvents?.length ?? 0;
for (final e in timeline.traceEvents ?? []) {
final raw = e.json;
if (raw == null) continue;
final name = raw['name'] as String? ?? '';
final cat = raw['cat'] as String? ?? '';
final ph = raw['ph'] as String? ?? '';
if (name == 'Frame' && cat == 'Dart' && ph == 'b') uiAsync++;
if (name == 'Animator::BeginFrame' && cat == 'Embedder' && ph == 'B') uiSync++;
if ((name == 'GPURasterizer::Draw' ||
name == 'CompositorContext::ScopedFrame::Raster') &&
cat == 'Embedder' &&
(ph == 'B' || ph == 'X')) rasterCount++;
}
return {
'total_events': total,
'ui_async_frames': uiAsync, // [Dart] Frame async — primary
'ui_sync_frames': uiSync, // Animator::BeginFrame sync — fallback
'raster_frames': rasterCount,
};
}