Files
.vs
Assets
Library
APIUpdater
Artifacts
Bee
BuildPlayerData
PackageCache
com.unity.collab-proxy@2.5.2
com.unity.editorcoroutines@1.0.0
com.unity.ext.nunit@1.0.6
com.unity.feature.development@1.0.1
com.unity.ide.rider@3.0.31
com.unity.ide.visualstudio@2.0.22
com.unity.ide.vscode@1.2.5
com.unity.modules.ai@1.0.0
com.unity.modules.androidjni@1.0.0
com.unity.modules.animation@1.0.0
com.unity.modules.assetbundle@1.0.0
com.unity.modules.audio@1.0.0
com.unity.modules.cloth@1.0.0
com.unity.modules.director@1.0.0
com.unity.modules.imageconversion@1.0.0
com.unity.modules.imgui@1.0.0
com.unity.modules.jsonserialize@1.0.0
com.unity.modules.particlesystem@1.0.0
com.unity.modules.physics2d@1.0.0
com.unity.modules.physics@1.0.0
com.unity.modules.screencapture@1.0.0
com.unity.modules.subsystems@1.0.0
com.unity.modules.terrain@1.0.0
com.unity.modules.terrainphysics@1.0.0
com.unity.modules.tilemap@1.0.0
com.unity.modules.ui@1.0.0
com.unity.modules.uielements@1.0.0
com.unity.modules.umbra@1.0.0
com.unity.modules.unityanalytics@1.0.0
com.unity.modules.unitywebrequest@1.0.0
com.unity.modules.unitywebrequestassetbundle@1.0.0
com.unity.modules.unitywebrequestaudio@1.0.0
com.unity.modules.unitywebrequesttexture@1.0.0
com.unity.modules.unitywebrequestwww@1.0.0
com.unity.modules.vehicles@1.0.0
com.unity.modules.video@1.0.0
com.unity.modules.vr@1.0.0
com.unity.modules.wind@1.0.0
com.unity.modules.xr@1.0.0
com.unity.performance.profile-analyzer@1.2.2
Documentation~
Editor
Tests
Editor
FrameTimeGraphSelectionTests.cs
FrameTimeGraphSelectionTests.cs.meta
MarkerDataAPITests.cs
MarkerDataAPITests.cs.meta
MicrosecondsUnitsTest.cs
MicrosecondsUnitsTest.cs.meta
MillisecondsUnitsTest.cs
MillisecondsUnitsTest.cs.meta
ProfileAnalysisAPITests.cs
ProfileAnalysisAPITests.cs.meta
ProfileAnalyzerAPITests.cs
ProfileAnalyzerAPITests.cs.meta
ProfileAnalyzerBaseTest.cs
ProfileAnalyzerBaseTest.cs.meta
ProfileAnalyzerCaptureTests.cs
ProfileAnalyzerCaptureTests.cs.meta
ProfileAnalyzerEmptyTests.cs
ProfileAnalyzerEmptyTests.cs.meta
ProfileDataAPITests.cs
ProfileDataAPITests.cs.meta
ProfileDataTests.cs
ProfileDataTests.cs.meta
UnitsTestFixture.cs
UnitsTestFixture.cs.meta
Unity.Performance.Profile-Analyzer.EditorTests.asmdef
Unity.Performance.Profile-Analyzer.EditorTests.asmdef.meta
.tests.json
Editor.meta
.signature
CHANGELOG.md
CHANGELOG.md.meta
Editor.meta
LICENSE.md
LICENSE.md.meta
README.md
README.md.meta
Tests.meta
package.json
package.json.meta
com.unity.settings-manager@2.0.1
com.unity.test-framework@1.1.33
com.unity.testtools.codecoverage@1.2.6
com.unity.textmeshpro@3.0.6
com.unity.timeline@1.7.6
com.unity.ugui@1.0.0
com.unity.visualscripting@1.9.4
PackageManager
PlayModeViewStates
PlayerDataCache
ScriptAssemblies
Search
ShaderCache
SplashScreenCache
StateCache
UIElements
AnnotationManager
ArtifactDB
ArtifactDB-lock
BuildPlayer.prefs
BuildSettings.asset
EditorOnlyScriptingSettings.json
EditorOnlyVirtualTextureState.json
EditorSnapSettings.asset
EditorUserBuildSettings.asset
InspectorExpandedItems.asset
LastBuild.buildreport
LastSceneManagerSetup.txt
LibraryFormatVersion.txt
MonoManager.asset
SceneVisibilityState.asset
ScriptMapper
ShaderCache.db
SourceAssetDB
SourceAssetDB-lock
SpriteAtlasDatabase.asset
Style.catalog
expandedItems
ilpp.pid
Logs
Packages
ProjectSettings
UserSettings
obj
.vsconfig
Assembly-CSharp.Player.csproj
Assembly-CSharp.csproj
TM1.sln
Unity.CollabProxy.Editor.csproj
Unity.EditorCoroutines.Editor.csproj
Unity.Performance.Profile-Analyzer.Editor.csproj
Unity.PlasticSCM.Editor.csproj
Unity.Rider.Editor.csproj
Unity.Settings.Editor.csproj
Unity.TestTools.CodeCoverage.Editor.OpenCover.Model.csproj
Unity.TestTools.CodeCoverage.Editor.OpenCover.Mono.Reflection.csproj
Unity.TestTools.CodeCoverage.Editor.csproj
Unity.TextMeshPro.Editor.csproj
Unity.TextMeshPro.Player.csproj
Unity.TextMeshPro.csproj
Unity.Timeline.Editor.csproj
Unity.Timeline.Player.csproj
Unity.Timeline.csproj
Unity.VSCode.Editor.csproj
Unity.VisualScripting.Core.Editor.csproj
Unity.VisualScripting.Core.Player.csproj
Unity.VisualScripting.Core.csproj
Unity.VisualScripting.Flow.Editor.csproj
Unity.VisualScripting.Flow.Player.csproj
Unity.VisualScripting.Flow.csproj
Unity.VisualScripting.SettingsProvider.Editor.csproj
Unity.VisualScripting.Shared.Editor.csproj
Unity.VisualScripting.State.Editor.csproj
Unity.VisualScripting.State.Player.csproj
Unity.VisualScripting.State.csproj
Unity.VisualStudio.Editor.csproj
UnityEditor.TestRunner.csproj
UnityEditor.UI.csproj
UnityEngine.TestRunner.Player.csproj
UnityEngine.TestRunner.csproj
UnityEngine.UI.Player.csproj
UnityEngine.UI.csproj

63 lines
3.0 KiB
C#
Raw Permalink Normal View History

2025-01-17 13:10:20 +01:00
using NUnit.Framework;
using System.Collections.Generic;
using UnityEngine;
public class ProfileAnalyzerEmptyTests : ProfileAnalyzerBaseTest
{
List<int> SelectRange(int startIndex, int endIndex)
{
List<int> list = new List<int>();
for (int c = startIndex; c <= endIndex; c++)
{
list.Add(c);
}
return list;
}
[Test]
public void ProfileAnalyzer_EmptyData_IsEmpty()
{
int k_FirstFrameInProfiler = 1;
int k_LastFrameInProfiler = 300;
int k_FrameCountInProfiler = k_LastFrameInProfiler - k_FirstFrameInProfiler + 1;
// the first and last frame are incomplete (empty) and therefore removed from the frame count of the loaded data in Profile Analyzer
int k_FrameCountInProfileAnalyzer = k_FrameCountInProfiler - 2;
// The first frame is invalid,
int k_FirstValidFrameInProfiler = k_FirstFrameInProfiler + 1;
// the first frame being missing is adjusted for via the frame offset, so only the last frame needs to be trimmed in
int k_LastFrameInProfileAnalyzer = k_LastFrameInProfiler - 1;
var analyzer = m_SetupData.analyzer;
var profileData = m_SetupData.profilerWindowInterface.PullFromProfiler(k_FirstFrameInProfiler, k_LastFrameInProfiler);
var depthFilter = m_SetupData.depthFilter;
var threadFilters = m_SetupData.threadFilters;
int firstFrameIndex = profileData.OffsetToDisplayFrame(0);
int lastFrameIndex = profileData.OffsetToDisplayFrame(profileData.GetFrameCount() - 1);
Assert.AreEqual(k_FirstValidFrameInProfiler, firstFrameIndex, "First Frame index not " + k_FirstValidFrameInProfiler);
Assert.AreEqual(k_LastFrameInProfileAnalyzer, lastFrameIndex, "Last Frame index is not " + k_LastFrameInProfileAnalyzer);
var analysis = analyzer.Analyze(profileData, SelectRange(firstFrameIndex, lastFrameIndex), threadFilters, depthFilter);
var frameSummary = analysis.GetFrameSummary();
Assert.AreEqual(0, analysis.GetThreads().Count);
Assert.AreEqual(0, frameSummary.msTotal);
Assert.AreEqual(k_FirstValidFrameInProfiler, frameSummary.first);
Assert.AreEqual(k_LastFrameInProfileAnalyzer, frameSummary.last);
Assert.AreEqual(k_FrameCountInProfileAnalyzer, frameSummary.count);
Assert.AreEqual(0, frameSummary.msMean);
Assert.AreEqual(0, frameSummary.msMedian);
Assert.AreEqual(0, frameSummary.msLowerQuartile);
Assert.AreEqual(0, frameSummary.msUpperQuartile);
Assert.AreEqual(0, frameSummary.msMin);
Assert.AreEqual(0, frameSummary.msMax);
Assert.AreEqual(Mathf.RoundToInt((float)(k_LastFrameInProfileAnalyzer + 0.1f) / 2.0f), frameSummary.medianFrameIndex);
Assert.AreEqual(k_FirstValidFrameInProfiler, frameSummary.minFrameIndex);
Assert.AreEqual(k_FirstValidFrameInProfiler, frameSummary.maxFrameIndex);
Assert.AreEqual(0, frameSummary.maxMarkerDepth);
Assert.AreEqual(0, frameSummary.totalMarkers);
}
}