Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Assets/Tests/InputSystem/CorePerformanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,5 +1207,58 @@ public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_Do
.Run();
}

[PrebuildSetup(typeof(ProjectWideActionsBuildSetup))]
[PostBuildCleanup(typeof(ProjectWideActionsBuildSetup))]
[UnityTest, Performance]
[Category("Performance")]
public IEnumerator Performance_MeasureInputSystemFrameTimeWithProfilerMarkers_Touch()
{
var touchscreen = InputSystem.AddDevice<Touchscreen>();
EnhancedTouchSupport.Enable();

var clickAction = InputSystem.actions.FindAction("Click");
var pointAction = InputSystem.actions.FindAction("Point");

int performedCallCount = 0;

clickAction.performed += context => {
performedCallCount++;
};

pointAction.performed += context => {
performedCallCount++;
};

using (Measure.ProfilerMarkers(allInputSystemProfilerMarkers))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess changes look ok here but I wonder what scenario we are trying to replicate here? It seems that there is not many touch points per frame here, essentially looks like one touch update per frame. That is fine given a e.g. 30 or 60 Hz touch sensor , but I believe most these days generate higher frequency of touch. It might be meaningful to measure a decently modern touch screen and take the actual achievable frequency. I wouldn't trust just reading specs since the HW frequency might be higher than what you get out of the driver.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It be good to outline the intended scenario as clearly as possible in the test description or inline (Seems like @jfreire-unity suggested something similar.

{
BeginTouch(1, new Vector2(0.1f, 0.2f), queueEventOnly: true);
BeginTouch(2, new Vector2(0.3f, 0.4f), queueEventOnly: true);

for (int i = 0; i < 500; ++i)
{
MoveTouch(1, new Vector2(0.1f + i, 0.2f + i), queueEventOnly: true);
MoveTouch(2, new Vector2(0.3f + i, 0.4f + i), queueEventOnly: true);

BeginTouch(3, new Vector2(0.5f, 0.6f), queueEventOnly: true);
MoveTouch(3, new Vector2(0.5f + i, 0.6f + i), queueEventOnly: true);
EndTouch(3, new Vector2(0.7f, 0.7f), queueEventOnly: true);

if (i % 60 == 0)
{
EndTouch(1, new Vector2(0.8f, 0.8f), queueEventOnly: true);
EndTouch(2, new Vector2(0.9f, 0.9f), queueEventOnly: true);
BeginTouch(1, new Vector2(0.1f, 0.2f), queueEventOnly: true);
BeginTouch(2, new Vector2(0.3f, 0.4f), queueEventOnly: true);
}

InputSystem.Update();

yield return null;
}
}

EnhancedTouchSupport.Disable();
}

#endif
}