From 76a18c211d06659328d99ef07b2a16da5e269200 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Thu, 26 Nov 2026 17:58:30 -0500 Subject: [PATCH] fix(steam): handle failed undo, read-back and setup paths in the Steam Lite supervisor and harness --- .../evidence/steam-lite/duo-flags.svg | 284 ++++++++------- .../steam-lite/duo-lite-plus-1388870-oom.svg | 140 ++++---- ...-lite-plus-ablate-bully-browser-target.svg | 88 ++--- .../duo-lite-plus-ablate-bully-hide.svg | 88 ++--- .../duo-lite-plus-ablate-bully-ingame.svg | 132 +++---- .../duo-lite-plus-ablate-library-ui.svg | 96 ++--- .../duo-lite-plus-burst-arcade-paradise.svg | 72 ++-- .../steam-lite/duo-lite-plus-steady.svg | 334 +++++++++--------- .../steam-lite/duo-lite-plus-tables.md | 14 +- .../usr/local/bin/droiddeck-steam-lite | 97 +++-- tools/steam_lite_bench.py | 82 +++-- tools/steam_lite_charts.py | 115 +++--- tools/tests/test_steam_lite.py | 47 ++- tools/tests/test_steam_lite_bench.py | 40 +++ 14 files changed, 912 insertions(+), 717 deletions(-) diff --git a/docs/development/evidence/steam-lite/duo-flags.svg b/docs/development/evidence/steam-lite/duo-flags.svg index f913ee7069..ccf3c1b4e3 100644 --- a/docs/development/evidence/steam-lite/duo-flags.svg +++ b/docs/development/evidence/steam-lite/duo-flags.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.267849 + 2026-11-26T17:58:05.894409 image/svg+xml @@ -41,12 +41,12 @@ z - - + @@ -222,7 +222,7 @@ z - + @@ -339,7 +339,7 @@ z - + @@ -471,7 +471,7 @@ z - + @@ -572,7 +572,7 @@ z - + @@ -637,16 +637,16 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -683,11 +683,11 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -729,11 +729,11 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -770,11 +770,11 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -822,11 +822,11 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -842,11 +842,11 @@ L 709.2 118.076066 +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -879,11 +879,11 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -958,10 +958,10 @@ z +" clip-path="url(#pea643ce1c0)" style="fill: #1f77b4"/> +" clip-path="url(#pea643ce1c0)" style="fill: #1f77b4"/> +" clip-path="url(#pea643ce1c0)" style="fill: #1f77b4"/> +" clip-path="url(#pea643ce1c0)" style="fill: #1f77b4"/> +" clip-path="url(#pea643ce1c0)" style="fill: #1f77b4"/> +" clip-path="url(#pea643ce1c0)" style="fill: #ff7f0e"/> +" clip-path="url(#pea643ce1c0)" style="fill: #ff7f0e"/> +" clip-path="url(#pea643ce1c0)" style="fill: #ff7f0e"/> +" clip-path="url(#pea643ce1c0)" style="fill: #ff7f0e"/> +" clip-path="url(#pea643ce1c0)" style="fill: #ff7f0e"/> +" clip-path="url(#pea643ce1c0)" style="fill: #2ca02c"/> +" clip-path="url(#pea643ce1c0)" style="fill: #2ca02c"/> +" clip-path="url(#pea643ce1c0)" style="fill: #2ca02c"/> +" clip-path="url(#pea643ce1c0)" style="fill: #2ca02c"/> +" clip-path="url(#pea643ce1c0)" style="fill: #2ca02c"/> +" clip-path="url(#pea643ce1c0)" style="fill: #d62728"/> +" clip-path="url(#pea643ce1c0)" style="fill: #d62728"/> +" clip-path="url(#pea643ce1c0)" style="fill: #d62728"/> +" clip-path="url(#pea643ce1c0)" style="fill: #d62728"/> +" clip-path="url(#pea643ce1c0)" style="fill: #d62728"/> - - - - - + + + + + + - - - + + + - - - - + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + + + - - - + + + - - - - + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + + + - - - + + + - - - - + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + + + - - - + + + - - - - + + + + + + - - - - + + + + - - - - + + + + @@ -1761,7 +1777,7 @@ z - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-1388870-oom.svg b/docs/development/evidence/steam-lite/duo-lite-plus-1388870-oom.svg index 4e9bbbd299..bea9d56911 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-1388870-oom.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-1388870-oom.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.749374 + 2026-11-26T17:58:06.487916 image/svg+xml @@ -41,12 +41,12 @@ z - - + @@ -121,7 +121,7 @@ z - + @@ -157,7 +157,7 @@ z - + @@ -198,7 +198,7 @@ z - + @@ -211,7 +211,7 @@ z - + @@ -225,7 +225,7 @@ z - + @@ -844,12 +844,12 @@ z - - + @@ -862,7 +862,7 @@ L -3.5 0 - + @@ -904,7 +904,7 @@ z - + @@ -936,7 +936,7 @@ z - + @@ -952,7 +952,7 @@ z - + @@ -968,7 +968,7 @@ z - + @@ -984,7 +984,7 @@ z - + @@ -1034,7 +1034,7 @@ z - + @@ -1050,7 +1050,7 @@ z - + @@ -1256,7 +1256,7 @@ L 620.305059 248.306527 L 627.13493 254.889685 L 633.95652 258.420635 L 640.685688 258.954273 -" clip-path="url(#pd93e328155)" style="fill: none; stroke: #808080; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #808080; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #808080; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #808080; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #808080; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #808080; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #9467bd; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #9467bd; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #1f77b4; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #1f77b4; stroke-opacity: 0.8; stroke-linecap: square"/> +" clip-path="url(#p4809e7a459)" style="fill: none; stroke: #000000; stroke-width: 0.8; stroke-linecap: square"/> - - - + + - - + + - - + + - - + + - - + + - - - + + - - + + - - - + + - - + + @@ -2384,7 +2384,7 @@ L 815.744977 317.877656 L 815.744977 131.745811 L 773.77955 131.745811 z -" clip-path="url(#pc80d1a129e)" style="fill: #dddddd"/> +" clip-path="url(#pde021122b9)" style="fill: #dddddd"/> +" clip-path="url(#pde021122b9)" style="fill: #dddddd"/> +" clip-path="url(#pde021122b9)" style="fill: #dddddd"/> +" clip-path="url(#pde021122b9)" style="fill: #dddddd"/> +" clip-path="url(#pde021122b9)" style="fill: #2ca02c"/> +" clip-path="url(#pde021122b9)" style="fill: #2ca02c"/> +" clip-path="url(#pde021122b9)" style="fill: #2ca02c"/> +" clip-path="url(#pde021122b9)" style="fill: #2ca02c"/> - + @@ -2463,7 +2463,7 @@ z - + @@ -2477,7 +2477,7 @@ z - + @@ -2505,7 +2505,7 @@ z - + @@ -2540,7 +2540,7 @@ z - + @@ -2564,7 +2564,7 @@ z - + @@ -2579,7 +2579,7 @@ z - + @@ -2594,7 +2594,7 @@ z - + @@ -2609,7 +2609,7 @@ z - + @@ -2624,7 +2624,7 @@ z - + @@ -2639,7 +2639,7 @@ z - + @@ -2820,10 +2820,10 @@ z - + - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-browser-target.svg b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-browser-target.svg index d3a7087e76..9ebdad21ca 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-browser-target.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-browser-target.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.366266 + 2026-11-26T17:58:06.100012 image/svg+xml @@ -43,7 +43,7 @@ L 151.705353 259.877656 L 151.705353 35.917984 L 90.02951 35.917984 z -" clip-path="url(#pcde407d3d5)" style="fill: #1f77b4"/> +" clip-path="url(#pb7f0054609)" style="fill: #1f77b4"/> +" clip-path="url(#pb7f0054609)" style="fill: #1f77b4"/> +" clip-path="url(#pb7f0054609)" style="fill: #ff7f0e"/> +" clip-path="url(#pb7f0054609)" style="fill: #ff7f0e"/> +" clip-path="url(#pb7f0054609)" style="fill: #2ca02c"/> +" clip-path="url(#pb7f0054609)" style="fill: #2ca02c"/> - - + @@ -377,7 +377,7 @@ z - + @@ -451,16 +451,16 @@ z +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -509,11 +509,11 @@ z +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -583,11 +583,11 @@ z +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -606,11 +606,11 @@ L 565.2 202.54398 +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -641,11 +641,11 @@ z +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -680,11 +680,11 @@ z +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -703,11 +703,11 @@ L 565.2 116.543466 +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -726,11 +726,11 @@ L 565.2 87.876628 +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -749,11 +749,11 @@ L 565.2 59.20979 +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1035,7 +1035,7 @@ z +" clip-path="url(#pb7f0054609)" style="fill: none; stroke: #000000; stroke-width: 0.8; stroke-linecap: square"/> - - - + + - - + + - - + + - - + + - - + + - - + + @@ -1490,7 +1490,7 @@ z - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-hide.svg b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-hide.svg index 4da143482a..21fc42ba58 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-hide.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-hide.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.441548 + 2026-11-26T17:58:06.181215 image/svg+xml @@ -43,7 +43,7 @@ L 140.342088 40.446503 L 140.342088 245.544729 L 76.971328 245.544729 z -" clip-path="url(#pb1ab6897cf)" style="fill: #1f77b4"/> +" clip-path="url(#p0b49bf6d14)" style="fill: #1f77b4"/> +" clip-path="url(#p0b49bf6d14)" style="fill: #1f77b4"/> +" clip-path="url(#p0b49bf6d14)" style="fill: #ff7f0e"/> +" clip-path="url(#p0b49bf6d14)" style="fill: #ff7f0e"/> +" clip-path="url(#p0b49bf6d14)" style="fill: #2ca02c"/> +" clip-path="url(#p0b49bf6d14)" style="fill: #2ca02c"/> - - + @@ -195,7 +195,7 @@ z - + @@ -284,16 +284,16 @@ z +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -358,11 +358,11 @@ z +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -437,11 +437,11 @@ z +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -457,11 +457,11 @@ L 565.2 199.004459 +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -503,11 +503,11 @@ z +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -523,11 +523,11 @@ L 565.2 146.151807 +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -559,11 +559,11 @@ z +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -579,11 +579,11 @@ L 565.2 93.299155 +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -598,11 +598,11 @@ L 565.2 66.872829 +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -959,7 +959,7 @@ z +" clip-path="url(#p0b49bf6d14)" style="fill: none; stroke: #000000; stroke-width: 0.8; stroke-linecap: square"/> - - - + + - - + + - - + + - - + + - - + + - - + + @@ -1444,7 +1444,7 @@ z - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-ingame.svg b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-ingame.svg index 8ee9e77174..d61728b2c1 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-ingame.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-bully-ingame.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.525956 + 2026-11-26T17:58:06.268377 image/svg+xml @@ -43,7 +43,7 @@ L 100.594591 43.716026 L 100.594591 248.844234 L 76.971328 248.844234 z -" clip-path="url(#p7f7db2870c)" style="fill: #1f77b4"/> +" clip-path="url(#p50e2356766)" style="fill: #1f77b4"/> +" clip-path="url(#p50e2356766)" style="fill: #1f77b4"/> +" clip-path="url(#p50e2356766)" style="fill: #1f77b4"/> +" clip-path="url(#p50e2356766)" style="fill: #1f77b4"/> +" clip-path="url(#p50e2356766)" style="fill: #1f77b4"/> +" clip-path="url(#p50e2356766)" style="fill: #ff7f0e"/> +" clip-path="url(#p50e2356766)" style="fill: #ff7f0e"/> +" clip-path="url(#p50e2356766)" style="fill: #ff7f0e"/> +" clip-path="url(#p50e2356766)" style="fill: #ff7f0e"/> +" clip-path="url(#p50e2356766)" style="fill: #ff7f0e"/> +" clip-path="url(#p50e2356766)" style="fill: #2ca02c"/> +" clip-path="url(#p50e2356766)" style="fill: #2ca02c"/> +" clip-path="url(#p50e2356766)" style="fill: #2ca02c"/> +" clip-path="url(#p50e2356766)" style="fill: #2ca02c"/> +" clip-path="url(#p50e2356766)" style="fill: #2ca02c"/> - - + @@ -237,7 +237,7 @@ z - + @@ -432,7 +432,7 @@ z - + @@ -474,7 +474,7 @@ z - + @@ -572,7 +572,7 @@ z - + @@ -593,16 +593,16 @@ z +" clip-path="url(#p50e2356766)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -667,11 +667,11 @@ z +" clip-path="url(#p50e2356766)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -721,11 +721,11 @@ z +" clip-path="url(#p50e2356766)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -767,11 +767,11 @@ z +" clip-path="url(#p50e2356766)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -803,11 +803,11 @@ z +" clip-path="url(#p50e2356766)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1066,7 +1066,7 @@ z +" clip-path="url(#p50e2356766)" style="fill: none; stroke: #000000; stroke-width: 0.8; stroke-linecap: square"/> - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -1550,7 +1550,7 @@ z - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-library-ui.svg b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-library-ui.svg index 67d38d53b4..9b77222405 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-ablate-library-ui.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-ablate-library-ui.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.605983 + 2026-11-26T17:58:06.351171 image/svg+xml @@ -43,7 +43,7 @@ L 117.571423 131.468225 L 117.571423 249.188672 L 76.971328 249.188672 z -" clip-path="url(#p0efb65f6be)" style="fill: #1f77b4"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #1f77b4"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #1f77b4"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #1f77b4"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #ff7f0e"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #ff7f0e"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #ff7f0e"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #2ca02c"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #2ca02c"/> +" clip-path="url(#p3a0e0ccd7a)" style="fill: #2ca02c"/> - - + @@ -189,7 +189,7 @@ z - + @@ -384,7 +384,7 @@ z - + @@ -429,16 +429,16 @@ z +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -516,11 +516,11 @@ z +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -562,11 +562,11 @@ z +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -598,11 +598,11 @@ z +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -616,11 +616,11 @@ L 565.2 131.468225 +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -635,11 +635,11 @@ L 565.2 90.270092 +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -930,7 +930,7 @@ z +" clip-path="url(#p3a0e0ccd7a)" style="fill: none; stroke: #000000; stroke-width: 0.8; stroke-linecap: square"/> - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -1430,7 +1430,7 @@ z - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-burst-arcade-paradise.svg b/docs/development/evidence/steam-lite/duo-lite-plus-burst-arcade-paradise.svg index 9de2c81e2d..0481eb37e7 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-burst-arcade-paradise.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-burst-arcade-paradise.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:10.057071 + 2026-11-26T17:58:06.827880 image/svg+xml @@ -42,16 +42,16 @@ z +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -88,11 +88,11 @@ z +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -133,11 +133,11 @@ z +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -168,11 +168,11 @@ z +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -187,11 +187,11 @@ L 495.512479 24.72 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -620,16 +620,16 @@ z +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -643,11 +643,11 @@ L -3.5 0 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -663,11 +663,11 @@ L 709.2 241.596699 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -684,11 +684,11 @@ L 709.2 201.315743 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -705,11 +705,11 @@ L 709.2 161.034786 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -726,11 +726,11 @@ L 709.2 120.753829 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -747,11 +747,11 @@ L 709.2 80.472872 +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -899,7 +899,7 @@ L 634.141898 105.285942 L 648.957783 84.58153 L 664.629152 79.425567 L 679.601925 79.425567 -" clip-path="url(#p0fd53866fe)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #2ca02c; stroke-width: 1.5; stroke-linecap: square"/> +" clip-path="url(#pdee6f611f7)" style="fill: none; stroke: #d62728; stroke-width: 1.5; stroke-linecap: square"/> - - - + + @@ -1640,7 +1640,7 @@ z - + @@ -1710,7 +1710,7 @@ z - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-steady.svg b/docs/development/evidence/steam-lite/duo-lite-plus-steady.svg index 25f2709388..72a9f6b8d6 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-steady.svg +++ b/docs/development/evidence/steam-lite/duo-lite-plus-steady.svg @@ -6,7 +6,7 @@ - 2026-11-26T17:33:09.927852 + 2026-11-26T17:58:06.698627 image/svg+xml @@ -41,12 +41,12 @@ z - - + @@ -173,7 +173,7 @@ z - + @@ -343,7 +343,7 @@ z - + @@ -454,16 +454,16 @@ z +" clip-path="url(#p9fc63f6e4e)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - - + @@ -500,11 +500,11 @@ z +" clip-path="url(#p9fc63f6e4e)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -520,11 +520,11 @@ L 356.4 250.375618 +" clip-path="url(#p9fc63f6e4e)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -561,11 +561,11 @@ z +" clip-path="url(#p9fc63f6e4e)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -613,11 +613,11 @@ z +" clip-path="url(#p9fc63f6e4e)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -674,11 +674,11 @@ z +" clip-path="url(#p9fc63f6e4e)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -756,7 +756,7 @@ L 95.076249 297.798125 L 95.076249 96.489582 L 71.604055 96.489582 z -" clip-path="url(#p40b4317381)" style="fill: #1f77b4"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #1f77b4"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #1f77b4"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #1f77b4"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #ff7f0e"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #ff7f0e"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #ff7f0e"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #2ca02c"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #2ca02c"/> +" clip-path="url(#p9fc63f6e4e)" style="fill: #2ca02c"/> - - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + @@ -1319,7 +1319,7 @@ z - + @@ -1336,7 +1336,7 @@ z - + @@ -1363,7 +1363,7 @@ z - + @@ -1389,11 +1389,11 @@ z +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1407,11 +1407,11 @@ L 712.8 297.798125 +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1454,11 +1454,11 @@ z +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1475,11 +1475,11 @@ L 712.8 226.382087 +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1496,11 +1496,11 @@ L 712.8 190.674068 +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1517,11 +1517,11 @@ L 712.8 154.966049 +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1538,11 +1538,11 @@ L 712.8 119.258031 +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1593,11 +1593,11 @@ z +" clip-path="url(#pcb180d0bb9)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -1625,7 +1625,7 @@ L 463.382434 297.798125 L 463.382434 284.443326 L 428.004055 284.443326 z -" clip-path="url(#pa36262096c)" style="fill: #1f77b4"/> +" clip-path="url(#pcb180d0bb9)" style="fill: #1f77b4"/> +" clip-path="url(#pcb180d0bb9)" style="fill: #1f77b4"/> +" clip-path="url(#pcb180d0bb9)" style="fill: #1f77b4"/> +" clip-path="url(#pcb180d0bb9)" style="fill: #ff7f0e"/> +" clip-path="url(#pcb180d0bb9)" style="fill: #ff7f0e"/> +" clip-path="url(#pcb180d0bb9)" style="fill: #ff7f0e"/> - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + @@ -1950,7 +1950,7 @@ z - + @@ -1967,7 +1967,7 @@ z - + @@ -1994,7 +1994,7 @@ z - + @@ -2020,11 +2020,11 @@ z +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2049,11 +2049,11 @@ z +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2069,11 +2069,11 @@ L 1069.2 268.606168 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2089,11 +2089,11 @@ L 1069.2 239.414211 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2109,11 +2109,11 @@ L 1069.2 210.222254 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2129,11 +2129,11 @@ L 1069.2 181.030297 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2149,11 +2149,11 @@ L 1069.2 151.83834 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2169,11 +2169,11 @@ L 1069.2 122.646383 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2189,11 +2189,11 @@ L 1069.2 93.454426 +" clip-path="url(#pe9ef50c8f3)" style="fill: none; stroke: #b0b0b0; stroke-opacity: 0.3; stroke-width: 0.8; stroke-linecap: square"/> - + @@ -2212,7 +2212,7 @@ L 819.782434 297.798125 L 819.782434 134.323166 L 784.404055 134.323166 z -" clip-path="url(#p5c556c0b89)" style="fill: #1f77b4"/> +" clip-path="url(#pe9ef50c8f3)" style="fill: #1f77b4"/> +" clip-path="url(#pe9ef50c8f3)" style="fill: #1f77b4"/> +" clip-path="url(#pe9ef50c8f3)" style="fill: #1f77b4"/> +" clip-path="url(#pe9ef50c8f3)" style="fill: #ff7f0e"/> +" clip-path="url(#pe9ef50c8f3)" style="fill: #ff7f0e"/> +" clip-path="url(#pe9ef50c8f3)" style="fill: #ff7f0e"/> - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + @@ -2693,13 +2693,13 @@ z - + - + - + diff --git a/docs/development/evidence/steam-lite/duo-lite-plus-tables.md b/docs/development/evidence/steam-lite/duo-lite-plus-tables.md index 5bae2d0e9f..554981a07c 100644 --- a/docs/development/evidence/steam-lite/duo-lite-plus-tables.md +++ b/docs/development/evidence/steam-lite/duo-lite-plus-tables.md @@ -1,11 +1,11 @@ -**duo-lite-plus: save load in app 1388870** (fresh session per trial; a trial counts once the load started) +**duo-lite-plus: save load in app 1388870** (fresh session per trial; a trial counts once the load started; a kill is an Android `LOW_MEMORY` exit) -| Arm | Trials loaded | Survived 90 s | Killed (lmkd) | Seconds from Continue to kill | -| --- | --- | --- | --- | --- | -| l1 | 2 of 2 | 0 | 2 | 33 (32-33) | -| softcomp+l1 | 3 of 3 | 0 | 3 | 30 (17-30) | -| softcomp | 2 of 2 | 0 | 2 | 24 (17-31) | -| stock | 2 of 3 | 0 | 2 | 30 (29-32) | +| Arm | Trials loaded | Survived 90 s | Killed (lmkd) | Stopped otherwise | Seconds from Continue to kill | +| --- | --- | --- | --- | --- | --- | +| l1 | 2 of 2 | 0 | 2 | 0 | 33 (32-33) | +| softcomp+l1 | 3 of 3 | 0 | 3 | 0 | 30 (17-30) | +| softcomp | 2 of 2 | 0 | 2 | 0 | 24 (17-31) | +| stock | 2 of 3 | 0 | 2 | 0 | 30 (29-32) | **duo-lite-plus bully-browser-target: one intervention at a time** (change from the sample just before it, MiB; negative = freed) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-lite b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-lite index f96107d043..5d3a40fc93 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-lite +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-lite @@ -47,6 +47,7 @@ SWAPPED_SKIP_KB = 32 * 1024 PAGEOUT_BUDGET_KB = 1024 * 1024 PAGEOUT_TIMEOUT = 6.0 READBACK_TIMEOUT = 8.0 +READBACK_ATTEMPTS = 3 GC_RELEASE_WAIT = 2.0 HOLD = Path("/tmp/.dd-zram.hold") UI_ORIGIN = "https://steamloopback.host/" @@ -406,11 +407,26 @@ class Actions: self.frozen = set() self.motion = set() self.hidden = set() + self.deadline = None + + def release(self, held, targets, method, params): + """Undo a held intervention; targets whose undo failed stay held for the next restore.""" + present = {t.get("id") for t in targets} + mine = [t for t in targets if t.get("id") in held] + out = self.each(mine, method, params) + for target in mine: + if isinstance(out.get(target.get("title") or "?"), int): + held.discard(target.get("id")) + held.intersection_update(present) + return out def each(self, targets, method, params=None, remember=None): out = {} for target in targets: start = self.clock() + if self.deadline is not None and start > self.deadline: + out[target.get("title") or "?"] = "skipped: pass budget spent" + continue try: self.client.call(target, method, params) out[target.get("title") or "?"] = round((self.clock() - start) * 1000) @@ -444,13 +460,14 @@ class Actions: def resume(self, targets): mine = [t for t in targets if t.get("id") in self.paused] - out = self.each(mine, "Animation.setPlaybackRate", {"playbackRate": 1}) + out = self.release(self.paused, targets, "Animation.setPlaybackRate", {"playbackRate": 1}) for target in mine: + if target.get("id") in self.paused: + continue try: self.client.call(target, "Animation.disable") except CdpError: pass - self.paused.clear() return out def freeze(self, targets): @@ -458,10 +475,7 @@ class Actions: return self.each(independent, "Page.setWebLifecycleState", {"state": "frozen"}, self.frozen) def thaw(self, targets): - mine = [t for t in targets if t.get("id") in self.frozen] - out = self.each(mine, "Page.setWebLifecycleState", {"state": "active"}) - self.frozen.clear() - return out + return self.release(self.frozen, targets, "Page.setWebLifecycleState", {"state": "active"}) def reduce_motion(self, targets): ui = [t for t in targets if is_ui(t)] @@ -469,10 +483,7 @@ class Actions: {"features": [{"name": "prefers-reduced-motion", "value": "reduce"}]}, self.motion) def full_motion(self, targets): - mine = [t for t in targets if t.get("id") in self.motion] - out = self.each(mine, "Emulation.setEmulatedMedia", {"features": []}) - self.motion.clear() - return out + return self.release(self.motion, targets, "Emulation.setEmulatedMedia", {"features": []}) def window_state(self, targets, state): """Browser.setWindowBounds on the client's own top-level window (not its popups).""" @@ -539,16 +550,23 @@ class ZramHold: self.inode = None def __enter__(self): + self.inode = None try: fd = os.open(self.path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600) - try: - if self.request: - os.write(fd, self.request.encode()) - self.inode = os.fstat(fd).st_ino - finally: - os.close(fd) except OSError: - self.inode = None + return self + try: + inode = os.fstat(fd).st_ino + if self.request: + os.write(fd, self.request.encode()) + self.inode = inode + except OSError: + try: + os.unlink(self.path) + except OSError: + pass + finally: + os.close(fd) return self @property @@ -571,6 +589,7 @@ class Pager: def __init__(self, hold_path=HOLD, proc=Path("/proc"), clock=time.monotonic, nap=time.sleep, signal_pid=None, pids=None): + self.attempts = 0 self.hold_path = Path(hold_path) self.proc = proc self.clock = clock @@ -626,7 +645,7 @@ class Pager: pids = self.pids() before = self.swapped(pids) if not pids or before < 1024: - self.out_kb = 0 + self.out_kb, self.attempts = 0, 0 return {"skipped": "nothing in zRAM", "kB": before} with ZramHold(self.hold_path, "0") as hold: if not hold.mine: @@ -642,7 +661,9 @@ class Pager: now = self.swapped(pids) steady = steady + 1 if now >= last else 0 last = now - self.out_kb = 0 + self.attempts += 1 + if last < max(1024, before // 4) or self.attempts >= READBACK_ATTEMPTS: + self.out_kb, self.attempts = 0, 0 return {"before kB": before, "after kB": last} @@ -781,7 +802,8 @@ class Supervisor: self.low_since = None def still_hidden(self): - self.read_focus() + if self.read_focus() is None: + return False app, games = self.game_app() return app is not None and app in games and app != STEAM_CLIENT @@ -813,20 +835,28 @@ class Supervisor: if visual and "freeze" in self.on: steps.append(("freeze", lambda: self.actions.freeze(found))) outcome = {} - with self.hold(): - for name, step in steps: - if not self.still_hidden(): - outcome["cancelled"] = "the client came to the front before %s" % name - break - if self.clock() - start > PASS_BUDGET: - outcome["cancelled"] = "pass budget spent before %s" % name - break - outcome[name] = step() + deadline = start + PASS_BUDGET + self.actions.deadline = deadline + try: + with self.hold(): + for name, step in steps: + if not self.still_hidden(): + outcome["cancelled"] = "the client came to the front before %s" % name + break + if self.clock() > deadline: + outcome["cancelled"] = "pass budget spent before %s" % name + break + outcome[name] = step() + finally: + self.actions.deadline = None if reclaim and "pageout" in self.on and "cancelled" not in outcome: if "gc" in outcome: self.nap(GC_RELEASE_WAIT) - if self.still_hidden(): - outcome["pageout"] = self.pager.pageout(PAGEOUT_BUDGET_KB) + left = deadline - self.clock() + if left <= 0: + outcome["cancelled"] = "pass budget spent before pageout" + elif self.still_hidden(): + outcome["pageout"] = self.pager.pageout(PAGEOUT_BUDGET_KB, timeout=min(PAGEOUT_TIMEOUT, left)) else: outcome["cancelled"] = "the client came to the front before pageout" if not self.still_hidden(): @@ -875,6 +905,11 @@ def run(agent_dir): return cached["targets"] def stop(*_): + try: + if supervisor.pager.out_kb: + log("read back on exit: %s" % json.dumps(supervisor.pager.readback())) + except Exception as error: + log("read back on exit failed: %s" % error) try: if actions.holding(): cached["at"] = None diff --git a/tools/steam_lite_bench.py b/tools/steam_lite_bench.py index 08639c8fdc..b624167c30 100644 --- a/tools/steam_lite_bench.py +++ b/tools/steam_lite_bench.py @@ -77,7 +77,9 @@ class Device: def profile(self, name: str) -> None: body = json.dumps(PROFILES[name]) - self.sh('printf %s "$1" > "$DD_LAUNCH_DIR/agent/steam-lite.json"', body) + reply = self.guest("sh", "-c", 'printf %s "$1" > "$DD_LAUNCH_DIR/agent/steam-lite.json"', "sh", body) + if reply.get("exitCode") != 0: + raise RuntimeError("could not switch the profile to %s: %s" % (name, json.dumps(reply)[:300])) def mark(self, text: str) -> None: self.sh('printf %s "$1" > ' + REMOTE + "/mark", text) @@ -138,12 +140,13 @@ with open(out, "w") as stream: def ablate(dev: Device, actions: list[str], waits: list[float], out: Path, label: str) -> list[dict]: """One action at a time: a sample before it, then one after each wait (seconds since the action).""" total = len(actions) * (max(waits) + 20) + 30 + remote = "%s/ablate-%s-%d.jsonl" % (REMOTE, label, int(time.time())) dev.sh("mkdir -p " + REMOTE) reply = dev.ctl("guest", "--timeout", str(min(600, total)), "--stdin", ABLATE, "--", "python3", "-", LITE, - REMOTE + "/ablate.jsonl", ",".join(actions), ",".join(str(w) for w in waits), timeout=min(600, total)) + remote, ",".join(actions), ",".join(str(w) for w in waits), timeout=min(600, total)) if reply.get("exitCode") != 0: - print(json.dumps({"guest": reply}), file=sys.stderr) - lines = [json.loads(x) for x in dev.fetch(REMOTE + "/ablate.jsonl").splitlines() if x.strip()] + raise RuntimeError("the ablation failed in the guest: %s" % json.dumps(reply)[:400]) + lines = [json.loads(x) for x in dev.fetch(remote).splitlines() if x.strip()] out.mkdir(parents=True, exist_ok=True) with open(out / (label + ".jsonl"), "w") as stream: for item in lines: @@ -179,14 +182,22 @@ def wait_focus(dev: Device, want, timeout: float) -> float | None: return None -def running(dev: Device) -> bool: - return bool((dev.ctl("state", timeout=40).get("session") or {}).get("running")) +def running(dev: Device, tries: int = 3) -> bool | None: + """Whether a session runs; None when the device could not be asked.""" + for attempt in range(tries): + state = dev.ctl("state", timeout=40) + if state.get("ok") and isinstance(state.get("session"), dict): + return bool(state["session"].get("running")) + time.sleep(1 + attempt) + return None def ensure_steam(dev: Device, fresh: bool = False) -> None: - if fresh and running(dev): + if fresh and running(dev) is not False: dev.ctl("stop", "--timeout", "90", timeout=100) - if not running(dev): + if running(dev) is not False: + raise RuntimeError("the old session did not stop") + if running(dev) is not True: dev.adb("shell", "monkey -p com.droiddeck.launcher -c android.intent.category.LAUNCHER 1") time.sleep(6) dev.ctl("wake", timeout=30) @@ -279,7 +290,7 @@ def oom_trial(dev: Device, app: str, profile: str, run_dir: Path, args) -> dict: lowest = base died = False while time.monotonic() - started < args.load_check: - if not running(dev): + if running(dev) is False: died = True break now = system_available(dev) @@ -298,14 +309,14 @@ def oom_trial(dev: Device, app: str, profile: str, run_dir: Path, args) -> dict: load_t = load_attempts[-1]["t"] if load_attempts else time.time() events["load_t"] = load_t before_load = base - alive = running(dev) + alive = running(dev) is not False if alive: dev.ctl("screenshot", str(run_dir / "after-inputs.png"), timeout=60) else: events["died_after_s"] = round(time.time() - load_t, 1) while alive and time.time() - load_t < args.watch: time.sleep(5) - if not running(dev): + if running(dev) is False: alive = False events["died_after_s"] = round(time.time() - load_t, 1) break @@ -383,7 +394,8 @@ def flags_run(dev: Device, variant: str, run_dir: Path, args) -> dict: for r in item["processes"]: if r["role"] not in NOT_CLIENT: roles[r["role"]] = roles.get(r["role"], 0) + (r.get("Pss") or 0) - rows.append({"total": sum(roles.values()) / 1024, "renderer": roles.get("renderer", 0) / 1024, + rows.append({"total": sum(roles.values()) / 1024, + "renderer": roles["renderer"] / 1024 if roles.get("renderer") else None, "browser": roles.get("browser", 0) / 1024, "gpu": sum((item.get("gpu") or {}).values()) / 1048576}) return {"variant": variant, "applied": events["helper_cmdline_has"], @@ -411,6 +423,8 @@ def cycle(dev: Device, app: str, profile: str, run_dir: Path, args) -> dict: launched = dev.ctl("launch", app, "--wait", "--timeout", str(args.launch_timeout), timeout=args.launch_timeout) events["launch_s"] = round(time.monotonic() - t0, 2) if launched.get("ok") else None events["launch_error"] = None if launched.get("ok") else launched.get("error") or launched.get("message") + if not launched.get("ok"): + raise RuntimeError("the game did not launch: %s" % events["launch_error"]) dev.mark("game") time.sleep(max(0, args.game - args.pacing)) pacing = dev.ctl("pacing", "--seconds", str(args.pacing), timeout=args.pacing + 30) @@ -448,6 +462,8 @@ def fresh_session(dev: Device, env: dict) -> bool: for key, value in env.items(): dev.ctl("env", "set", "--persistent", "%s=%s" % (key, value), timeout=30) dev.ctl("stop", "--timeout", "60", timeout=80) + if running(dev) is not False: + return False dev.adb("shell", "monkey -p com.droiddeck.launcher -c android.intent.category.LAUNCHER 1") time.sleep(5) return bool(dev.ctl("start", "steam", "--wait", "--timeout", "300", timeout=320).get("ok")) @@ -494,11 +510,16 @@ def steady(dev: Device, level: str, app: str, out: Path) -> dict: """One fresh session at one level: library, a game in front for 80 s, three overlay round trips, library.""" out.mkdir(parents=True, exist_ok=True) run = {"level": level, "app": app, "started": fresh_session(dev, {"DD_STEAM_LITE": level})} + if not run["started"]: + raise RuntimeError("Steam did not start for level %s" % level) time.sleep(30) run["idle"] = snapshot(dev, "library idle") t0 = time.monotonic() run["launch_ok"] = bool(dev.ctl("launch", app, "--wait", "--timeout", "180", timeout=200).get("ok")) run["launch_s"] = round(time.monotonic() - t0, 1) + if not run["launch_ok"]: + (out / "run.json").write_text(json.dumps(run, indent=1)) + raise RuntimeError("app %s did not take focus" % app) time.sleep(60) a = snapshot(dev, "game +60s") time.sleep(20) @@ -531,6 +552,8 @@ def library(dev: Device, soft: str, out: Path) -> dict: """The settled library (90 s after start) with the web helper composited on the GPU or in software.""" out.mkdir(parents=True, exist_ok=True) run = {"soft": soft, "started": fresh_session(dev, {"DD_STEAM_SOFT_COMPOSITING": soft})} + if not run["started"]: + raise RuntimeError("Steam did not start with DD_STEAM_SOFT_COMPOSITING=%s" % soft) time.sleep(90) a = snapshot(dev, "library +90s") time.sleep(20) @@ -585,8 +608,9 @@ def summarize(samples: list[dict], events: dict) -> dict: tail = pss[len(pss) // 2:] row[name + "_pss_mib"] = round(statistics.median(tail) / 1024, 1) row[name + "_pss_peak_mib"] = round(max(pss) / 1024, 1) - row[name + "_web_pss_mib"] = round(statistics.median([t["pss"] for t in web[len(web) // 2:] - if t["pss"] is not None]) / 1024, 1) + web_tail = [t["pss"] for t in web[len(web) // 2:] if t["pss"] is not None] + if web_tail: + row[name + "_web_pss_mib"] = round(statistics.median(web_tail) / 1024, 1) row[name + "_swappss_mib"] = round(statistics.median([t["swap"] for t in trees[len(trees) // 2:]]) / 1024, 1) avail = [s["memory"].get("MemAvailable") for s in group if s["memory"].get("MemAvailable")] if avail: @@ -636,7 +660,7 @@ def report(root: Path) -> list[dict]: samples, events = load(events_path.parent) except (OSError, ValueError): continue - if not samples: + if not samples or events.get("kind") in ("oom", "flags") or "profile" not in events: continue row = summarize(samples, events) row["run"] = str(events_path.parent.relative_to(root)) @@ -713,6 +737,7 @@ def main(argv=None) -> int: p_report.add_argument("root", type=Path) args = parser.parse_args(argv) dev = Device(args.serial) + failed = 0 if args.command == "info": print(json.dumps(info(dev, args.out), indent=1)) return 0 @@ -722,16 +747,24 @@ def main(argv=None) -> int: counts[level] = counts.get(level, 0) + 1 name = "%s-%d" % ("stock" if level == "stock" else "l" + level, counts[level]) print("== steady", name, flush=True) - steady(dev, level, args.app, args.out / name) - return 0 + try: + steady(dev, level, args.app, args.out / name) + except Exception as error: + failed += 1 + print("run failed: %r" % error, flush=True) + return 1 if failed else 0 if args.command == "library": counts = {} for soft in args.order.split(","): counts[soft] = counts.get(soft, 0) + 1 name = "%s-%d" % ("softcomp" if soft == "1" else "default", counts[soft]) print("== library", name, flush=True) - library(dev, soft, args.out / name) - return 0 + try: + library(dev, soft, args.out / name) + except Exception as error: + failed += 1 + print("run failed: %r" % error, flush=True) + return 1 if failed else 0 if args.command == "flags": try: for i in range(args.repeat): @@ -741,10 +774,11 @@ def main(argv=None) -> int: print(json.dumps(flags_run(dev, variant, args.out / ("flags-%s-r%d" % (variant, i + 1)), args)), flush=True) except Exception as error: + failed += 1 print("run failed: %r" % error, flush=True) finally: set_variant(dev, "default") - return 0 + return 1 if failed else 0 if args.command in ("cycle", "oom"): for item in getattr(args, "env", None) or []: dev.ctl("env", "set", "--persistent", item, timeout=30) @@ -770,7 +804,10 @@ def main(argv=None) -> int: for key, value in env.items(): dev.ctl("env", "set", "--persistent", "%s=%s" % (key, value), timeout=30) args.arm, args.env = name, ["%s=%s" % kv for kv in env.items()] - run_dir = args.out / ("oom-%s-%s-r%d" % (args.app, args.arm or name, i + 1)) + arm = args.arm or name + if args.arm and not arms and len(names) > 1: + arm = "%s-%s" % (args.arm, name) + run_dir = args.out / ("oom-%s-%s-r%d" % (args.app, arm, i + 1)) events = oom_trial(dev, args.app, profile, run_dir, args) print(json.dumps({k: events.get(k) for k in ("arm", "profile", "loaded", "survived", "died_after_s", "exit", "launch_s")}), flush=True) @@ -778,8 +815,9 @@ def main(argv=None) -> int: cycle(dev, args.app, name, run_dir, args) print(json.dumps(summarize(*load(run_dir))), flush=True) except Exception as error: + failed += 1 print("run failed: %r" % error, flush=True) - return 0 + return 1 if failed else 0 if args.command == "ablate": rows = ablate(dev, args.actions.split(","), [float(w) for w in args.waits.split(",")], args.out, args.label) for row in rows: diff --git a/tools/steam_lite_charts.py b/tools/steam_lite_charts.py index 2db658e8f1..3e4304583a 100644 --- a/tools/steam_lite_charts.py +++ b/tools/steam_lite_charts.py @@ -23,6 +23,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parent)) import steam_lite_bench as bench # noqa: E402 NOT_CLIENT = bench.NOT_CLIENT +# ApplicationExitInfo.REASON_LOW_MEMORY, as `dumpsys activity exit-info` prints it. +LOW_MEMORY = "3" ORDER = ["stock", "1", "2", "3", "l1", "softcomp", "softcomp+l1", "gc", "moderate", "critical", "pause", "freeze", "gc+critical"] @@ -33,14 +35,15 @@ NAMES = {"stock": "stock", "1": "L1 conservative", "2": "L2 balanced", "3": "L3 def runs(device_dir: Path) -> list[dict]: rows = [] for events in sorted(device_dir.glob("*/events.json")): - if json.loads(events.read_text()).get("kind") in ("oom", "flags"): - continue try: samples, ev = bench.load(events.parent) - except (OSError, ValueError): - continue - if samples: + if ev.get("kind") in ("oom", "flags") or "profile" not in ev or not samples: + continue row = bench.summarize(samples, ev) + except (OSError, ValueError, KeyError, statistics.StatisticsError) as error: + print("skipping %s: %s" % (events.parent, error), file=sys.stderr) + continue + if row: row["run"] = events.parent.name row["app"] = ev.get("app") rows.append(row) @@ -209,27 +212,48 @@ def chart_oom(device: str, device_dir: Path, out: Path) -> list[Path]: return made +def median_of(values) -> float | None: + known = [v for v in values if v is not None] + return statistics.median(known) if known else None + + +def role_pss(item: dict, role: str | None) -> float | None: + """Summed PSS of one role (all client roles for None) in MiB; None when none of it was readable.""" + rows = [r for r in item["processes"] if r["role"] not in NOT_CLIENT and (role is None or r["role"] == role)] + known = [r["Pss"] for r in rows if r.get("Pss") is not None] + return sum(known) / 1024 if known else None + + +def flag_sample(item: dict) -> dict: + return {"total": role_pss(item, None), "renderer": role_pss(item, "renderer"), + "browser": role_pss(item, "browser"), "gpu": sum((item.get("gpu") or {}).values()) / 1048576} + + +def flag_runs(device_dir: Path): + for events_path in sorted(device_dir.glob("**/flags-*/events.json")): + try: + events = json.loads(events_path.read_text()) + items = [json.loads(x) for x in (events_path.parent / "samples.jsonl").read_text().splitlines() + if x.strip()] + except (OSError, ValueError) as error: + print("skipping %s: %s" % (events_path.parent, error), file=sys.stderr) + continue + if items and "variant" in events: + yield events_path, events, items + + def chart_flags(device: str, device_dir: Path, out: Path) -> list[Path]: rows = [] - for events_path in sorted(device_dir.glob("**/flags-*/events.json")): - events = json.loads(events_path.read_text()) - lines = (events_path.parent / "samples.jsonl").read_text().splitlines() - for line in lines: - item = json.loads(line) - roles = {} - for r in item["processes"]: - if r["role"] not in NOT_CLIENT: - roles[r["role"]] = roles.get(r["role"], 0) + (r.get("Pss") or 0) - rows.append({"profile": events["variant"], "total": sum(roles.values()) / 1024, - "renderer": roles.get("renderer", 0) / 1024, "browser": roles.get("browser", 0) / 1024, - "gpu": sum((item.get("gpu") or {}).values()) / 1048576, - "run": events_path.parent.name}) + for events_path, events, items in flag_runs(device_dir): + for item in items: + rows.append({"profile": events["variant"], **flag_sample(item), + "run": events_path.parent.relative_to(device_dir).as_posix()}) if not rows: return [] per_run = {} for r in rows: per_run.setdefault(r["run"], []).append(r) - medians = [{"profile": rs[0]["profile"], **{k: statistics.median(x[k] for x in rs) + medians = [{"profile": rs[0]["profile"], **{k: median_of(x[k] for x in rs) for k in ("total", "renderer", "browser", "gpu")}} for rs in per_run.values()] variants = list(dict.fromkeys(r["profile"] for r in medians)) @@ -362,44 +386,41 @@ def tables(device: str, device_dir: Path) -> str: """Markdown tables of every measurement in device_dir, medians with the full range.""" out = [] flags = {} - for events_path in sorted(device_dir.glob("**/flags-*/events.json")): - events = json.loads(events_path.read_text()) - rows = [json.loads(x) for x in (events_path.parent / "samples.jsonl").read_text().splitlines() if x.strip()] - if not rows: - continue - def med(key): - vals = [] - for item in rows: - if key == "gpu": - vals.append(sum((item.get("gpu") or {}).values()) / 1048576) - else: - vals.append(sum(r.get("Pss") or 0 for r in item["processes"] if r["role"] not in NOT_CLIENT - and (key == "total" or r["role"] == key)) / 1024) - return statistics.median(vals) - flags.setdefault(events["variant"], []).append({k: med(k) for k in ("total", "renderer", "browser", "gpu")}) + for _, events, items in flag_runs(device_dir): + samples = [flag_sample(item) for item in items] + flags.setdefault(events["variant"], []).append( + {k: median_of(x[k] for x in samples) for k in ("total", "renderer", "browser", "gpu")}) if flags: out.append("**%s: library idle per web helper variant** (one fresh session per run, median of its samples; " "cells are median (min-max) over runs, MiB)\n" % device) out.append("| Variant | Runs | Client tree PSS | Renderer PSS | Browser PSS | KGSL GPU (not in PSS) |") out.append("| --- | --- | --- | --- | --- | --- |") for variant, runs_ in flags.items(): - out.append("| %s | %d | %s | %s | %s | %s |" % (variant, len(runs_), *[fmt([r[k] for r in runs_]) - for k in ("total", "renderer", "browser", "gpu")])) + out.append("| %s | %d | %s | %s | %s | %s |" % ( + variant, len(runs_), *[fmt([r[k] for r in runs_ if r[k] is not None]) + for k in ("total", "renderer", "browser", "gpu")])) out.append("") - trials = {} + by_app = {} for events_path in sorted(device_dir.glob("oom-*/events.json")): - events = json.loads(events_path.read_text()) - trials.setdefault(events.get("arm") or events["profile"], []).append(events) - if trials: - out.append("**%s: save load in app %s** (fresh session per trial; a trial counts once the load started)\n" - % (device, next(iter(trials.values()))[0]["app"])) - out.append("| Arm | Trials loaded | Survived 90 s | Killed (lmkd) | Seconds from Continue to kill |") - out.append("| --- | --- | --- | --- | --- |") + try: + events = json.loads(events_path.read_text()) + except (OSError, ValueError) as error: + print("skipping %s: %s" % (events_path.parent, error), file=sys.stderr) + continue + arms = by_app.setdefault(events.get("app"), {}) + arms.setdefault(events.get("arm") or events.get("profile"), []).append(events) + for app, trials in by_app.items(): + out.append("**%s: save load in app %s** (fresh session per trial; a trial counts once the load started; " + "a kill is an Android `LOW_MEMORY` exit)\n" % (device, app)) + out.append("| Arm | Trials loaded | Survived 90 s | Killed (lmkd) | Stopped otherwise | " + "Seconds from Continue to kill |") + out.append("| --- | --- | --- | --- | --- | --- |") for arm, group in trials.items(): valid = [e for e in group if e.get("loaded")] - killed = [e for e in valid if not e.get("survived")] - out.append("| %s | %d of %d | %d | %d | %s |" % ( - arm, len(valid), len(group), sum(1 for e in valid if e.get("survived")), len(killed), + stopped = [e for e in valid if not e.get("survived")] + killed = [e for e in stopped if (e.get("exit") or {}).get("reason") == LOW_MEMORY] + out.append("| %s | %d of %d | %d | %d | %d | %s |" % ( + arm, len(valid), len(group), len(valid) - len(stopped), len(killed), len(stopped) - len(killed), fmt([e["died_after_s"] for e in killed if e.get("died_after_s") is not None]))) out.append("") for path in sorted(device_dir.glob("ablate-*.jsonl")): diff --git a/tools/tests/test_steam_lite.py b/tools/tests/test_steam_lite.py index c49c33abee..d3eb30a4c1 100644 --- a/tools/tests/test_steam_lite.py +++ b/tools/tests/test_steam_lite.py @@ -209,6 +209,26 @@ class ActionsTest(unittest.TestCase): self.actions.freeze([SHARED, popup, STORE]) self.assertEqual([t for t, _, _ in self.log], ['w']) + def test_a_failed_thaw_stays_held_for_the_next_restore(self): + log = [] + c = client(log, broken=('Page.setWebLifecycleState',)) + actions = Actions(c, clock=lambda: 0.0) + actions.frozen = {'w'} + actions.thaw(TARGETS) + self.assertEqual(actions.frozen, {'w'}) + self.assertTrue(actions.holding()) + + def test_a_closed_target_is_no_longer_held(self): + self.actions.frozen = {'gone'} + self.actions.thaw(TARGETS) + self.assertEqual(self.actions.frozen, set()) + + def test_calls_past_the_deadline_are_skipped(self): + self.actions.deadline = -1.0 + out = self.actions.gc(TARGETS) + self.assertEqual(self.log, []) + self.assertTrue(all(str(v).startswith('skipped') for v in out.values())) + def test_only_page_targets_are_listed(self): self.assertEqual([t['id'] for t in self.client.targets()], ['s', 'b', 'q', 'w']) @@ -229,7 +249,7 @@ class FakePager: self.out_kb = 0 self.calls = [] - def pageout(self, budget): + def pageout(self, budget, timeout=None): self.calls.append(('pageout', budget)) self.out_kb = 100 * 1024 return {'kB': self.out_kb} @@ -451,6 +471,20 @@ class SupervisorTest(unittest.TestCase): sup.tick(self.targets) self.assertEqual(self.pager.calls, []) + def test_unreadable_focus_cancels_a_pass(self): + sup = self.make('3', '+pause') + self.focus(1234, [769, 1234]) + sup.tick(self.targets) + self.now += SETTLE + + def gc_then_lose_focus(targets): + (self.dir / 'focus.json').unlink() + return {} + self.actions.gc = gc_then_lose_focus + sup.tick(self.targets) + self.assertIn('cancelled', sup.history[-1]['outcome']) + self.assertNotIn('Animation.setPlaybackRate', self.methods()) + def test_game_exit_returns_to_ui(self): sup = self.make('2') self.focus(1234, [769, 1234]) @@ -506,6 +540,17 @@ class PagerTest(unittest.TestCase): self.assertIn('skipped', out) self.assertEqual((self.signalled, self.hold.read_text()), ([], '1')) + def test_an_incomplete_readback_stays_pending_until_the_retry_cap(self): + for pid in (10, 11): + (self.proc / str(pid) / 'status').write_text('VmSwap:\t8192 kB\n') + pager = self.pager(lambda pid: None) + pager.out_kb = 16384 + for attempt in range(MODULE['READBACK_ATTEMPTS'] - 1): + pager.readback() + self.assertEqual(pager.out_kb, 16384) + pager.readback() + self.assertEqual(pager.out_kb, 0) + def test_readback_asks_for_everything_back(self): def swapped_then_back(pid): (self.proc / str(pid) / 'status').write_text('VmSwap:\t0 kB\n') diff --git a/tools/tests/test_steam_lite_bench.py b/tools/tests/test_steam_lite_bench.py index 2dec8bb417..3a366cd217 100644 --- a/tools/tests/test_steam_lite_bench.py +++ b/tools/tests/test_steam_lite_bench.py @@ -50,5 +50,45 @@ class AccountingTest(unittest.TestCase): self.assertEqual(out['idle_web_cpu_pct'], 10.0) +class FakeDevice: + def __init__(self, replies): + self.replies = list(replies) + + def ctl(self, *args, timeout=0): + return self.replies.pop(0) + + +class HarnessTest(unittest.TestCase): + def setUp(self): + self.sleep = bench.time.sleep + bench.time.sleep = lambda s: None + self.addCleanup(setattr, bench.time, 'sleep', self.sleep) + + def test_an_unanswered_state_query_is_not_a_stopped_session(self): + self.assertIsNone(bench.running(FakeDevice([{'ok': False}] * 3))) + self.assertIs(bench.running(FakeDevice([{'ok': False}, {'ok': True, 'session': {'running': False}}])), False) + self.assertIs(bench.running(FakeDevice([{'ok': True, 'session': {'running': True}}])), True) + + def test_unreadable_web_pss_keeps_the_phase(self): + samples = [sample(t, 'idle', [row(1, 'client', 1024, 0), row(2, 'renderer', None, 0)]) for t in range(4)] + out = bench.summarize(samples, {'profile': 'stock'}) + self.assertEqual(out['idle_pss_mib'], 1.0) + self.assertNotIn('idle_web_pss_mib', out) + + def test_report_only_summarizes_cycle_runs(self): + import json + import tempfile + with tempfile.TemporaryDirectory() as temp: + root = Path(temp) + for name, events in (('flags-default-r1', {'kind': 'flags', 'variant': 'default'}), + ('cycle-r1', {'profile': '1', 'app': '1'})): + (root / name).mkdir() + (root / name / 'events.json').write_text(json.dumps(events)) + (root / name / 'samples.jsonl').write_text( + json.dumps(sample(0, 'idle', [row(1, 'client', 1024, 0)])) + '\n') + rows = bench.report(root) + self.assertEqual([r['profile'] for r in rows], ['1']) + + if __name__ == '__main__': unittest.main()