< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LinealBufferFPSCounter()0%110100%
AddDeltaTime(...)0%440100%
CurrentFPSCount()0%2100%
GetTotalSeconds()0%2100%

File(s)

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

#LineLine coverage
 1namespace DCL.FPSDisplay
 2{
 3    public class LinealBufferFPSCounter
 4    {
 5        public const int MAX_BUFFER_SIZE = 1000;
 46        public readonly float[] values = new float[MAX_BUFFER_SIZE];
 7
 08        public int begin { get; private set; } = 0;
 09        public int end { get; private set; } = 0;
 010        public float secondsBetweenBeginAndEnd { get; private set; } = 0;
 011        public float secondsInBuffer { get; private set; } = 0;
 012        public int countBetweenBeginAndEnd { get; private set; } = 0;
 13
 14        public void AddDeltaTime(float valueInSeconds)
 15        {
 370116            values[end++] = valueInSeconds;
 370117            secondsInBuffer += valueInSeconds;
 370118            secondsBetweenBeginAndEnd += valueInSeconds;
 370119            countBetweenBeginAndEnd++;
 20
 370121            if (end == MAX_BUFFER_SIZE)
 322                end = 0;
 23
 720424            while (secondsBetweenBeginAndEnd > 1)
 25            {
 350326                secondsInBuffer -= values[begin];
 350327                secondsBetweenBeginAndEnd -= values[begin++];
 350328                countBetweenBeginAndEnd--;
 350329                if (begin == MAX_BUFFER_SIZE)
 230                    begin = 0;
 31            }
 370132        }
 033        public float CurrentFPSCount() { return countBetweenBeginAndEnd; }
 034        public float GetTotalSeconds() { return secondsInBuffer; }
 35    }
 36}