|
13 | 13 | using UnityEngine.InputSystem.Users; |
14 | 14 | using UnityEngine.InputSystem.Utilities; |
15 | 15 | using UnityEngine.TestTools; |
16 | | -using static System.Collections.Specialized.BitVector32; |
17 | 16 |
|
18 | 17 | ////TODO: add test for domain reload logic |
19 | 18 |
|
@@ -1104,22 +1103,25 @@ public void Performance_OptimizedControls_ReadingPose4kTimes(OptimizationTestTyp |
1104 | 1103 | #endif |
1105 | 1104 |
|
1106 | 1105 | #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 | + |
1107 | 1119 | [PrebuildSetup(typeof(ProjectWideActionsBuildSetup))] |
1108 | 1120 | [PostBuildCleanup(typeof(ProjectWideActionsBuildSetup))] |
1109 | 1121 | [UnityTest, Performance] |
1110 | 1122 | [Category("Performance")] |
1111 | 1123 | public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_FPS() |
1112 | 1124 | { |
1113 | | - string[] markers = |
1114 | | - { |
1115 | | - "InputUpdate", |
1116 | | - "InputSystem.onBeforeUpdate", |
1117 | | - "InputSystem.onAfterUpdate", |
1118 | | - "PreUpdate.NewInputUpdate", |
1119 | | - "PreUpdate.InputForUIUpdate", |
1120 | | - "FixedUpdate.NewInputFixedUpdate" |
1121 | | - }; |
1122 | | - |
1123 | 1125 | var keyboard = InputSystem.AddDevice<Keyboard>(); |
1124 | 1126 | var mouse = InputSystem.AddDevice<Mouse>(); |
1125 | 1127 |
|
@@ -1151,7 +1153,7 @@ public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_FP |
1151 | 1153 | performedCallCount++; |
1152 | 1154 | }; |
1153 | 1155 |
|
1154 | | - using (Measure.ProfilerMarkers(markers)) |
| 1156 | + using (Measure.ProfilerMarkers(allInputSystemProfilerMarkers)) |
1155 | 1157 | { |
1156 | 1158 | Press(keyboard.wKey, queueEventOnly: true); |
1157 | 1159 |
|
@@ -1189,21 +1191,11 @@ public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_FP |
1189 | 1191 | [Category("Performance")] |
1190 | 1192 | public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_DoingNothing() |
1191 | 1193 | { |
1192 | | - string[] markers = |
1193 | | - { |
1194 | | - "InputUpdate", |
1195 | | - "InputSystem.onBeforeUpdate", |
1196 | | - "InputSystem.onAfterUpdate", |
1197 | | - "PreUpdate.NewInputUpdate", |
1198 | | - "PreUpdate.InputForUIUpdate", |
1199 | | - "FixedUpdate.NewInputFixedUpdate" |
1200 | | - }; |
1201 | | - |
1202 | 1194 | yield return Measure.Frames() |
1203 | 1195 | .WarmupCount(30) |
1204 | 1196 | .DontRecordFrametime() |
1205 | 1197 | .MeasurementCount(500) |
1206 | | - .ProfilerMarkers(markers) |
| 1198 | + .ProfilerMarkers(allInputSystemProfilerMarkers) |
1207 | 1199 | .Run(); |
1208 | 1200 | } |
1209 | 1201 |
|
|
0 commit comments