Skip to content

Commit 9d8d5f7

Browse files
committed
move profiler markers array to class level
1 parent 93dff2b commit 9d8d5f7

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

Assets/Tests/InputSystem/CorePerformanceTests.cs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using UnityEngine.InputSystem.Users;
1414
using UnityEngine.InputSystem.Utilities;
1515
using UnityEngine.TestTools;
16-
using static System.Collections.Specialized.BitVector32;
1716

1817
////TODO: add test for domain reload logic
1918

@@ -1104,22 +1103,25 @@ public void Performance_OptimizedControls_ReadingPose4kTimes(OptimizationTestTyp
11041103
#endif
11051104

11061105
#if UNITY_2022_3_OR_NEWER
1106+
1107+
// All the profiler markers in the package code.
1108+
// Needed for the tests below.
1109+
string[] allInputSystemProfilerMarkers =
1110+
{
1111+
"InputUpdate",
1112+
"InputSystem.onBeforeUpdate",
1113+
"InputSystem.onAfterUpdate",
1114+
"PreUpdate.NewInputUpdate",
1115+
"PreUpdate.InputForUIUpdate",
1116+
"FixedUpdate.NewInputFixedUpdate"
1117+
};
1118+
11071119
[PrebuildSetup(typeof(ProjectWideActionsBuildSetup))]
11081120
[PostBuildCleanup(typeof(ProjectWideActionsBuildSetup))]
11091121
[UnityTest, Performance]
11101122
[Category("Performance")]
11111123
public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_FPS()
11121124
{
1113-
string[] markers =
1114-
{
1115-
"InputUpdate",
1116-
"InputSystem.onBeforeUpdate",
1117-
"InputSystem.onAfterUpdate",
1118-
"PreUpdate.NewInputUpdate",
1119-
"PreUpdate.InputForUIUpdate",
1120-
"FixedUpdate.NewInputFixedUpdate"
1121-
};
1122-
11231125
var keyboard = InputSystem.AddDevice<Keyboard>();
11241126
var mouse = InputSystem.AddDevice<Mouse>();
11251127

@@ -1151,7 +1153,7 @@ public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_FP
11511153
performedCallCount++;
11521154
};
11531155

1154-
using (Measure.ProfilerMarkers(markers))
1156+
using (Measure.ProfilerMarkers(allInputSystemProfilerMarkers))
11551157
{
11561158
Press(keyboard.wKey, queueEventOnly: true);
11571159

@@ -1189,21 +1191,11 @@ public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_FP
11891191
[Category("Performance")]
11901192
public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_DoingNothing()
11911193
{
1192-
string[] markers =
1193-
{
1194-
"InputUpdate",
1195-
"InputSystem.onBeforeUpdate",
1196-
"InputSystem.onAfterUpdate",
1197-
"PreUpdate.NewInputUpdate",
1198-
"PreUpdate.InputForUIUpdate",
1199-
"FixedUpdate.NewInputFixedUpdate"
1200-
};
1201-
12021194
yield return Measure.Frames()
12031195
.WarmupCount(30)
12041196
.DontRecordFrametime()
12051197
.MeasurementCount(500)
1206-
.ProfilerMarkers(markers)
1198+
.ProfilerMarkers(allInputSystemProfilerMarkers)
12071199
.Run();
12081200
}
12091201

0 commit comments

Comments
 (0)