< Summary

Class:DCL.PerformanceMetricsController
Assembly:PerformanceController
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/Debugging/Performance/PerformanceMetricsController.cs
Covered lines:0
Uncovered lines:14
Coverable lines:14
Total lines:45
Line coverage:0% (0 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PerformanceMetricsController()0%2100%
Update()0%20400%
Report(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/Debugging/Performance/PerformanceMetricsController.cs

#LineLine coverage
 1using DCL.Interface;
 2using DCL.FPSDisplay;
 3using DCL.SettingsCommon;
 4using UnityEngine;
 5
 6namespace DCL
 7{
 8    public class PerformanceMetricsController
 9    {
 010        private LinealBufferHiccupCounter tracker = new LinealBufferHiccupCounter();
 11        private const int SAMPLES_SIZE = 1000; // Send performance report every 1000 samples
 012        private char[] encodedSamples = new char[SAMPLES_SIZE];
 13        private int currentIndex = 0;
 14
 15        [SerializeField] private PerformanceMetricsDataVariable performanceMetricsDataVariable;
 16
 017        public PerformanceMetricsController() { performanceMetricsDataVariable = Resources.Load<PerformanceMetricsDataVa
 18
 19        public void Update()
 20        {
 21#if !UNITY_EDITOR
 22            if (!CommonScriptableObjects.focusState.Get())
 23                return;
 24#endif
 025            if (!CommonScriptableObjects.rendererState.Get())
 026                return;
 27
 028            var deltaInMs = Time.deltaTime * 1000;
 29
 030            tracker.AddDeltaTime(Time.deltaTime);
 31
 032            performanceMetricsDataVariable?.Set(tracker.CurrentFPSCount(), tracker.CurrentHiccupCount(), tracker.Hiccups
 33
 034            encodedSamples[currentIndex++] = (char)deltaInMs;
 35
 036            if (currentIndex == SAMPLES_SIZE)
 37            {
 038                currentIndex = 0;
 039                Report(new string(encodedSamples));
 40            }
 041        }
 42
 043        private void Report(string encodedSamples) { WebInterface.SendPerformanceReport(encodedSamples, Settings.i.quali
 44    }
 45}