< 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:44
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 UnityEngine;
 4
 5namespace DCL
 6{
 7    public class PerformanceMetricsController
 8    {
 09        private LinealBufferHiccupCounter tracker = new LinealBufferHiccupCounter();
 10        private const int SAMPLES_SIZE = 1000; // Send performance report every 1000 samples
 011        private char[] encodedSamples = new char[SAMPLES_SIZE];
 12        private int currentIndex = 0;
 13
 14        [SerializeField] private PerformanceMetricsDataVariable performanceMetricsDataVariable;
 15
 016        public PerformanceMetricsController() { performanceMetricsDataVariable = Resources.Load<PerformanceMetricsDataVa
 17
 18        public void Update()
 19        {
 20#if !UNITY_EDITOR
 21            if (!CommonScriptableObjects.focusState.Get())
 22                return;
 23#endif
 024            if (!CommonScriptableObjects.rendererState.Get())
 025                return;
 26
 027            var deltaInMs = Time.deltaTime * 1000;
 28
 029            tracker.AddDeltaTime(Time.deltaTime);
 30
 031            performanceMetricsDataVariable?.Set(tracker.CurrentFPSCount(), tracker.CurrentHiccupCount(), tracker.Hiccups
 32
 033            encodedSamples[currentIndex++] = (char)deltaInMs;
 34
 035            if (currentIndex == SAMPLES_SIZE)
 36            {
 037                currentIndex = 0;
 038                Report(new string(encodedSamples));
 39            }
 040        }
 41
 042        private void Report(string encodedSamples) { WebInterface.SendPerformanceReport(encodedSamples, Settings.i.curre
 43    }
 44}