CockpitPerformanceSummary.fromJson constructor

CockpitPerformanceSummary.fromJson(
  1. Object? value
)

Implementation

factory CockpitPerformanceSummary.fromJson(Object? value) {
  final json = _object(value, r'$.summary');
  final layer = _object(json['layerCache'], r'$.summary.layerCache');
  final picture = _object(json['pictureCache'], r'$.summary.pictureCache');
  final gc = json['gc'];
  final gcJson = gc == null ? null : _object(gc, r'$.summary.gc');
  return CockpitPerformanceSummary(
    frameCount: _nonNegativeInt(json['frames'], r'$.summary.frames'),
    jankCount: _nonNegativeInt(json['jank'], r'$.summary.jank'),
    fps: json['fps'] == null
        ? null
        : _positiveDouble(json['fps'], r'$.summary.fps'),
    build: CockpitPerformancePhaseSummary.fromJson(json['build']),
    raster: CockpitPerformancePhaseSummary.fromJson(json['raster']),
    vsync: CockpitPerformancePhaseSummary.fromJson(json['vsync']),
    total: CockpitPerformancePhaseSummary.fromJson(json['total']),
    layerCacheMax: <String, int>{
      'count': _nonNegativeInt(layer['count'], r'$.summary.layerCache.count'),
      'bytes': _nonNegativeInt(layer['bytes'], r'$.summary.layerCache.bytes'),
    },
    pictureCacheMax: <String, int>{
      'count': _nonNegativeInt(
        picture['count'],
        r'$.summary.pictureCache.count',
      ),
      'bytes': _nonNegativeInt(
        picture['bytes'],
        r'$.summary.pictureCache.bytes',
      ),
    },
    newGenGcCount: gcJson?['new'] == null
        ? null
        : _nonNegativeInt(gcJson!['new'], r'$.summary.gc.new'),
    oldGenGcCount: gcJson?['old'] == null
        ? null
        : _nonNegativeInt(gcJson!['old'], r'$.summary.gc.old'),
  );
}