< 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:48
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%12300%
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 && UNITY_WEBGL
 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(),
 33                tracker.CurrentHiccupCount(),
 34                tracker.HiccupsSum,
 35                tracker.GetTotalSeconds());
 36
 037            encodedSamples[currentIndex++] = (char)deltaInMs;
 38
 039            if (currentIndex == SAMPLES_SIZE)
 40            {
 041                currentIndex = 0;
 042                Report(new string(encodedSamples));
 43            }
 044        }
 45
 046        private void Report(string encodedSamples) { WebInterface.SendPerformanceReport(encodedSamples, Settings.i.quali
 47    }
 48}