perf(gui): Resolve massive frametime bloat by throttling telemetry and optimizing UI updates
This commit is contained in:
38
tests/test_gui_performance_requirements.py
Normal file
38
tests/test_gui_performance_requirements.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import pytest
|
||||
import time
|
||||
from api_hook_client import ApiHookClient
|
||||
|
||||
def test_idle_performance_requirements():
|
||||
"""
|
||||
Requirement: GUI must maintain < 16.6ms frametime on idle.
|
||||
This test will fail if the performance is regressed.
|
||||
"""
|
||||
client = ApiHookClient(base_url="http://127.0.0.1:8999")
|
||||
|
||||
try:
|
||||
# Get multiple samples to be sure
|
||||
samples = []
|
||||
for _ in range(5):
|
||||
perf_data = client.get_performance()
|
||||
samples.append(perf_data)
|
||||
time.sleep(0.1)
|
||||
|
||||
# Parse the JSON metrics
|
||||
for sample in samples:
|
||||
performance = sample.get('performance', {})
|
||||
frame_time = performance.get('last_frame_time_ms', 0.0)
|
||||
|
||||
# If frame_time is 0.0, it might mean the app just started and hasn't finished a frame yet
|
||||
# or it's not actually running the main loop.
|
||||
assert frame_time < 16.6, f"Frame time {frame_time}ms exceeds 16.6ms threshold"
|
||||
|
||||
except Exception as e:
|
||||
pytest.fail(f"Failed to verify performance requirements: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
client = ApiHookClient(base_url="http://127.0.0.1:8999")
|
||||
try:
|
||||
perf = client.get_performance()
|
||||
print(f"Current performance: {perf}")
|
||||
except Exception as e:
|
||||
print(f"App not running or error: {e}")
|
||||
Reference in New Issue
Block a user