< Summary

Class:FPSDebugMetricModule
Assembly:FPSDisplay
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/Debugging/FPSDisplay/MetricsModules/FPSDebugMetricModule.cs
Covered lines:0
Uncovered lines:19
Coverable lines:19
Total lines:56
Line coverage:0% (0 of 19)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:8
Method coverage:0% (0 of 8)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
FPSDebugMetricModule(...)0%2100%
Dispose()0%2100%
SetUpModule(...)0%2100%
UpdateModule()0%2100%
EnableModule()0%2100%
DisableModule()0%2100%
GetFPSCount()0%2100%
GetHiccupsLoss()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/Debugging/FPSDisplay/MetricsModules/FPSDebugMetricModule.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using DCL;
 4using DCL.FPSDisplay;
 5using MainScripts.DCL.WorldRuntime.Debugging.Performance;
 6
 7public class FPSDebugMetricModule : IDebugMetricModule
 8{
 9    private const string NO_DECIMALS = "##";
 10    private const string TWO_DECIMALS = "##.00";
 11
 12    private readonly PerformanceMetricsDataVariable performanceData;
 13
 14    private float fps;
 15    private string fpsColor;
 16
 17    private Service<IProfilerRecordsService> profilerRecordsService;
 18
 019    public FPSDebugMetricModule(PerformanceMetricsDataVariable performanceData)
 20    {
 021        this.performanceData = performanceData;
 022    }
 23
 024    public void Dispose() { }
 25
 26    public void SetUpModule(Dictionary<DebugValueEnum, Func<string>> updateValueDictionary)
 27    {
 028        updateValueDictionary.Add(DebugValueEnum.FPS, GetFPSCount);
 029        updateValueDictionary.Add(DebugValueEnum.FPS_HiccupsInTheLast1000, () => $"{fpsColor}{performanceData.Get().hicc
 030        updateValueDictionary.Add(DebugValueEnum.FPS_HiccupsLoss, GetHiccupsLoss);
 031        updateValueDictionary.Add(DebugValueEnum.FPS_BadFramesPercentiles, () => $"{fpsColor}{((performanceData.Get().hi
 032    }
 33
 34    public void UpdateModule()
 35    {
 036        fps = performanceData.Get().fpsCount;
 037        fpsColor = FPSColoring.GetDisplayColorString(fps);
 038    }
 39
 040    public void EnableModule() {  }
 41
 042    public void DisableModule() {  }
 43
 44    private string GetFPSCount()
 45    {
 046        (float FrameTime, float FPS) averageData = profilerRecordsService.Ref.AverageData;
 47
 048        var fpsFormatted = averageData.FPS.ToString("##");
 049        var msFormatted =  averageData.FrameTime.ToString("##");
 50
 051        return $"<b>FPS</b> {fpsColor}{fpsFormatted}</color> {msFormatted} ms";
 52    }
 53
 54    private string GetHiccupsLoss() =>
 055        $"{fpsColor}{(100.0f * performanceData.Get().hiccupSum / performanceData.Get().totalSeconds).ToString(TWO_DECIMA
 56}