[MG_IntegrationTest] (Disaggregated): sample frame statistics after present is applied

This commit is contained in:
2026-09-20 04:51:49 -04:00
parent 3c97ea9cfc
commit 911a957085
3 changed files with 22 additions and 0 deletions
@@ -87,6 +87,22 @@ namespace MGITest {
return session && session->Control() && session->Control()->producerParked.load(std::memory_order_acquire);
#else
return false;
#endif
}
bool WaitForSplitAppliedForTesting(unsigned long long seq, unsigned int timeoutMs) {
#if defined(MGITEST_SPLIT_RUNTIME_PEEK_LIVE)
auto* session = MobileGL::MG_Remote::Client::ClientSession::Active();
auto* control = session ? session->Control() : nullptr;
if (!control) return false;
const auto until = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeoutMs);
do {
if (control->appliedSeq.load(std::memory_order_acquire) >= seq) return true;
std::this_thread::sleep_for(std::chrono::milliseconds(1));
} while (std::chrono::steady_clock::now() < until);
return control->appliedSeq.load(std::memory_order_acquire) >= seq;
#else
(void)seq; (void)timeoutMs;
return false;
#endif
}
void DelaySplitRetirementForTesting(bool enabled) {
@@ -121,6 +121,9 @@ namespace MGITest {
bool SplitApplyHoldIsActiveForTesting();
void ReleaseSplitApplyHoldForTesting();
bool SplitProducerIsParkedForTesting();
// Observe completion for assertions about an emitted frame; does not emit a
// GL command or change the production wait rule.
bool WaitForSplitAppliedForTesting(unsigned long long seq, unsigned int timeoutMs = 5000);
// Empty when this process is a real split run that can be asserted about; otherwise the
@@ -161,6 +161,9 @@ void main() { color = vec4(value, 0.25, 0.75, 1.0); }
EXPECT_NEAR(pixel[2], 191, 1);
EXPECT_EQ(pixel[3], 255);
Gl().EndFrame();
// Present returns before apply under run-ahead. Inspect this completed
// frame's window, not the previous (possibly empty setup) log line.
ASSERT_TRUE(WaitForSplitAppliedForTesting(PeekSplitRuntime().emitSeq));
const auto window = PipeStatsWindow::LastFromLaneLog();
ASSERT_TRUE(window.found) << "P5f rsp window missing on frame " << frame;
// Magma does not publish Espryt's draw counter. The changing uniform and