< Summary

Class:DCL.MetricsScoreUtils
Assembly:DCL.Runtime
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/SceneMetricsCounter/MetricsScoreUtils.cs
Covered lines:5
Uncovered lines:2
Coverable lines:7
Total lines:31
Line coverage:71.4% (5 of 7)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ComputeAudioClipScore(...)0%2.062075%
ComputeTextureScore(...)0%2.152066.67%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/SceneMetricsCounter/MetricsScoreUtils.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCL
 4{
 5    public static class MetricsScoreUtils
 6    {
 7        public static long ComputeAudioClipScore(AudioClip audioClip)
 8        {
 229            if (audioClip == null)
 010                return 0;
 11
 2212            long baseOverhead = 3000; // Measured 2708 profiling AudioClip with 1 sample and 2 channels.
 13            // Rounding up just in case.
 14
 15            // For most cases the sample resolution should be of 65535 (PCM)
 16            const double BYTES_PER_SAMPLE = 2;
 2217            return (long) (audioClip.samples * audioClip.channels * BYTES_PER_SAMPLE) + baseOverhead;
 18        }
 19
 20        public static long ComputeTextureScore(Texture2D texture)
 21        {
 23122            if (texture == null)
 023                return 0;
 24
 25            // The mipmap memory increase should be actually 1.33 according to many sources
 26            const double MIPMAP_FACTOR = 1.4f;
 27            const double BYTES_PER_PIXEL = 4;
 23128            return (long) (texture.width * texture.height * BYTES_PER_PIXEL * MIPMAP_FACTOR);
 29        }
 30    }
 31}