timing refactor
All checks were successful
CI / React UI Build (push) Successful in 10s
CI / Native Windows Build And Tests (push) Successful in 3m1s
CI / Windows Release Package (push) Successful in 3m20s

This commit is contained in:
Aiden
2026-05-12 23:39:57 +10:00
parent 4a049a557a
commit d411453f80
17 changed files with 125 additions and 112 deletions

View File

@@ -57,32 +57,29 @@ void TestAcquirePublishesAndSchedules()
Expect(metrics.scheduledFrames == 1, "scheduled metric is counted");
}
void TestAcquireDropsOldestCompletedUnscheduled()
void TestAcquirePreservesCompletedFrames()
{
SystemFrameExchange exchange(MakeConfig(2));
SystemFrame first;
SystemFrame second;
SystemFrame third;
Expect(exchange.AcquireForRender(first), "first frame can be acquired");
Expect(exchange.AcquireForRender(first), "first preserving frame can be acquired");
first.frameIndex = 1;
Expect(exchange.PublishCompleted(first), "first frame can be completed");
Expect(exchange.AcquireForRender(second), "second frame can be acquired");
Expect(exchange.PublishCompleted(first), "first preserving frame can be completed");
Expect(exchange.AcquireForRender(second), "second preserving frame can be acquired");
second.frameIndex = 2;
Expect(exchange.PublishCompleted(second), "second frame can be completed");
Expect(exchange.PublishCompleted(second), "second preserving frame can be completed");
Expect(exchange.AcquireForRender(third), "third acquire drops the oldest completed frame");
Expect(third.index == first.index, "oldest completed slot is reused");
Expect(!exchange.AcquireForRender(third), "render acquire refuses to drop completed frames");
SystemFrame scheduled;
Expect(exchange.ConsumeCompletedForSchedule(scheduled), "remaining completed frame can be scheduled");
Expect(scheduled.index == second.index, "newer completed frame survives drop");
Expect(scheduled.frameIndex == 2, "newer frame index survives drop");
Expect(exchange.ConsumeCompletedForSchedule(scheduled), "oldest completed frame survives acquire miss");
Expect(scheduled.frameIndex == 1, "preserving acquire keeps FIFO output continuity");
SystemFrameExchangeMetrics metrics = exchange.Metrics();
Expect(metrics.completedDrops == 1, "drop metric is counted");
Expect(metrics.renderingCount == 1, "reused slot is rendering");
Expect(metrics.scheduledCount == 1, "consumed slot is scheduled");
Expect(metrics.completedDrops == 0, "preserving acquire does not count completed drops");
Expect(metrics.acquireMisses == 1, "preserving acquire miss is counted");
}
void TestScheduledFramesAreNotDropped()
@@ -179,7 +176,7 @@ void TestStableCompletedDepthTimesOut()
int main()
{
TestAcquirePublishesAndSchedules();
TestAcquireDropsOldestCompletedUnscheduled();
TestAcquirePreservesCompletedFrames();
TestScheduledFramesAreNotDropped();
TestGenerationValidationRejectsStaleFrames();
TestPixelFormatAwareSizing();