getPerformanceSnapshot method
Get performance snapshot
Implementation
Map<String, dynamic> getPerformanceSnapshot() {
final uptime = DateTime.now().difference(_sessionStart);
return {
'fps': {
'current': _currentFPS.toStringAsFixed(1),
'average': _fpsHistory.isEmpty
? '0.0'
: (_fpsHistory.reduce((a, b) => a + b) / _fpsHistory.length)
.toStringAsFixed(1),
'min': _fpsHistory.isEmpty
? '0.0'
: _fpsHistory.reduce((a, b) => a < b ? a : b).toStringAsFixed(1),
'max': _fpsHistory.isEmpty
? '0.0'
: _fpsHistory.reduce((a, b) => a > b ? a : b).toStringAsFixed(1),
'history': _fpsHistory.map((f) => f.toStringAsFixed(1)).toList(),
},
'memory': {
'currentMB': (_currentMemory / (1024 * 1024)).toStringAsFixed(2),
'averageMB': _memoryHistory.isEmpty
? '0.00'
: (_memoryHistory.reduce((a, b) => a + b) /
_memoryHistory.length /
(1024 * 1024))
.toStringAsFixed(2),
'minMB': _memoryHistory.isEmpty
? '0.00'
: (_memoryHistory.reduce((a, b) => a < b ? a : b) / (1024 * 1024))
.toStringAsFixed(2),
'maxMB': _memoryHistory.isEmpty
? '0.00'
: (_memoryHistory.reduce((a, b) => a > b ? a : b) / (1024 * 1024))
.toStringAsFixed(2),
'history': _memoryHistory
.map((m) => (m / (1024 * 1024)).toStringAsFixed(2))
.toList(),
},
'signalUpdates': {
'totalUpdates':
_signalUpdateCounts.values.fold(0, (sum, count) => sum + count),
'uniqueSignals': _signalUpdateCounts.length,
'topSignals': _getTopSignals(),
},
'session': {
'uptimeSeconds': uptime.inSeconds,
'uptimeFormatted': _formatDuration(uptime),
},
'benchmarks': _benchmarkResults,
};
}