From 665609f7ed699e3102cf2e01e09afd2823b0510f Mon Sep 17 00:00:00 2001 From: James Frowen Date: Mon, 29 Mar 2021 17:30:29 +0100 Subject: [PATCH] adding spawn counts to test --- .../InterestManagementPerformanceBase.cs | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Assets/Tests/Performance/Runtime/InterestManagement/InterestManagementPerformanceBase.cs b/Assets/Tests/Performance/Runtime/InterestManagement/InterestManagementPerformanceBase.cs index dd08912a7b8..5532d2df069 100644 --- a/Assets/Tests/Performance/Runtime/InterestManagement/InterestManagementPerformanceBase.cs +++ b/Assets/Tests/Performance/Runtime/InterestManagement/InterestManagementPerformanceBase.cs @@ -1,8 +1,10 @@ using System; using System.Collections; using Cysharp.Threading.Tasks; +using Mirage.Examples.InterestManagement; using Mirage.InterestManagement; using NUnit.Framework; +using Unity.PerformanceTesting; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; @@ -52,7 +54,12 @@ protected override IEnumerator SetupInterestManagement(NetworkServer server) public abstract class InterestManagementPerformanceBase { const string testScene = "Assets/Examples/InterestManagement/Scenes/Scene.unity"; - const int clientCount = 10; + const string NpcSpawnerName = "NpcSpawner"; + const string LootSpawnerName = "LootSpawner"; + const int clientCount = 100; + const int stationaryCount = 3500; + const int movingCount = 500; + private NetworkServer server; private LoopbackTransport transport; @@ -66,6 +73,9 @@ public IEnumerator Setup() // wait 1 frame for start to be called yield return null; + GameObject.Find(LootSpawnerName).GetComponent().count = stationaryCount; + GameObject.Find(NpcSpawnerName).GetComponent().count = movingCount; + server = FindObjectOfType(); transport = server.gameObject.AddComponent(); @@ -130,5 +140,23 @@ public IEnumerator RunsWithoutErrors() { yield return new WaitForSeconds(5); } + + [UnityTest, Performance] + public IEnumerator FramePerformance() + { + SampleGroup[] sampleGroups = + { + new SampleGroup("Observers", SampleUnit.Microsecond), + new SampleGroup("OnAuthenticated", SampleUnit.Microsecond), + new SampleGroup("OnSpawned", SampleUnit.Microsecond), + }; + + yield return Measure.Frames() + .ProfilerMarkers(sampleGroups) + .WarmupCount(5) + .MeasurementCount(300) + .Run(); + } + } }