ci: trace Windows build IO one-off

This commit is contained in:
Adam Perry
2026-07-08 01:05:19 +00:00
parent 38276e23da
commit 26adde1b8c
3 changed files with 218 additions and 4 deletions

41
.github/scripts/windows-io-trace.ps1 vendored Normal file
View File

@@ -0,0 +1,41 @@
param(
[Parameter(Mandatory = $true)]
[ValidateSet("mark", "transition", "stop")]
[string]$Action,
[string]$Label,
[string]$From,
[string]$To
)
$ErrorActionPreference = "Stop"
function Invoke-Wpr {
param([string[]]$Arguments)
& wpr @Arguments
if ($LASTEXITCODE -ne 0) {
throw "wpr $($Arguments -join ' ') failed with exit code $LASTEXITCODE"
}
}
switch ($Action) {
"mark" {
Invoke-Wpr @("-marker", $Label)
}
"transition" {
Invoke-Wpr @("-marker", "step:end:$From")
Invoke-Wpr @("-marker", "step:start:$To")
}
"stop" {
Invoke-Wpr @("-marker", "step:end:$Label")
$traceRoot = Join-Path $env:RUNNER_TEMP "codex-io-trace"
New-Item -ItemType Directory -Force -Path $traceRoot | Out-Null
$tracePath = Join-Path $traceRoot "windows-io-$($env:GITHUB_JOB)-$($env:GITHUB_RUN_ID)-$($env:GITHUB_RUN_ATTEMPT).etl"
Invoke-Wpr @("-stop", $tracePath)
Write-Output "saved Windows I/O trace to $tracePath"
}
}