Skip to content

Commit

Permalink
adding spawn counts to test
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Mar 29, 2021
1 parent 462ceb2 commit 665609f
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -66,6 +73,9 @@ public IEnumerator Setup()

// wait 1 frame for start to be called
yield return null;
GameObject.Find(LootSpawnerName).GetComponent<Spawner>().count = stationaryCount;
GameObject.Find(NpcSpawnerName).GetComponent<Spawner>().count = movingCount;


server = FindObjectOfType<NetworkServer>();
transport = server.gameObject.AddComponent<LoopbackTransport>();
Expand Down Expand Up @@ -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();
}

}
}

0 comments on commit 665609f

Please sign in to comment.