<# .SYNOPSIS #422 rate measurement: N offline captures WITHOUT a debugger (the debug heap can change allocation layout and mask a corruption), optionally forcing a non-incremental Release rebuild of AcDream.App before run 1 so run 1 is a genuine "first launch after a build" — the condition under which the VM7 matrix reproduced the exit. .EXAMPLE pwsh tools/i422/loop-plain.ps1 -Runs 12 -Preset retail -Resolution 1920x1080 -WarmupMs 45000 -RebuildFirst #> param( [int]$Runs = 12, [ValidateSet('retail', 'low', 'medium', 'high', 'auto')][string]$Preset = 'retail', [string]$Resolution = '1920x1080', [int]$WarmupMs = 45000, [string]$OutLeaf = 'i422plain', [switch]$RebuildFirst, [string]$ExeOverride) $ErrorActionPreference = 'Continue' $repo = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path $root = Join-Path $repo ('artifacts' + [IO.Path]::DirectorySeparatorChar + $OutLeaf) New-Item -ItemType Directory -Force $root | Out-Null $summary = Join-Path $root 'summary.txt' "run,gateExit,shutdownLine" | Set-Content $summary if ($RebuildFirst) { & dotnet build (Join-Path $repo 'src\AcDream.App\AcDream.App.csproj') -c Release --no-incremental --nologo -v q | Select-Object -Last 2 } for ($i = 1; $i -le $Runs; $i++) { $out = Join-Path $root ("run-{0:D2}" -f $i) $gateOut = Join-Path $root ("gate-{0:D2}.out" -f $i) $gateErr = Join-Path $root ("gate-{0:D2}.err" -f $i) $gateArgs = @( '-NoProfile', '-File', (Join-Path $repo 'tools\run-offline-pixel-gate.ps1'), '-Out', $out, '-SkipBuild', '-RenderPackPreset', $Preset, '-Resolution', $Resolution, '-WarmupMs', "$WarmupMs", '-Uncapped') if ($ExeOverride) { $gateArgs += @('-ExeOverride', $ExeOverride) } $gate = Start-Process -FilePath 'pwsh' -ArgumentList $gateArgs ` -PassThru -WindowStyle Hidden -RedirectStandardOutput $gateOut -RedirectStandardError $gateErr $gate.WaitForExit() $shutdown = '' $m = Select-String -Path $gateErr -Pattern 'exited with code|timed out|No screenshot' -ErrorAction SilentlyContinue | Select-Object -First 1 if ($m) { $shutdown = $m.Line.Trim() -replace ',', ';' } "$i,$($gate.ExitCode),$shutdown" | Add-Content $summary Write-Host ("run {0}: gate {1} {2}" -f $i, $gate.ExitCode, $shutdown) } Get-Content $summary