#requires -Version 5.1 <# sample_fleet.ps1 One-shot working-set + private-bytes + virtual-bytes sample for every running acclient.exe. Appends to artifacts/soak/memtrace_fleet.csv. Usage: powershell -ExecutionPolicy Bypass -File bin\sample_fleet.ps1 or schedule via ScheduleWakeup with a recurring 1500-1800s cadence. #> $ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot $logDir = Join-Path $root 'artifacts\soak' if (-not (Test-Path $logDir)) { New-Item -ItemType Directory -Path $logDir -Force | Out-Null } $csv = Join-Path $logDir 'memtrace_fleet.csv' if (-not (Test-Path $csv)) { 'ts_utc,pid,start,uptime_h,ws_mb,private_mb,virtual_mb,handle_count,thread_count' | Out-File -FilePath $csv -Encoding utf8 } $now = [DateTime]::UtcNow $procs = Get-Process -Name acclient -ErrorAction SilentlyContinue foreach ($p in $procs) { $up = [math]::Round(($now - $p.StartTime.ToUniversalTime()).TotalHours, 2) $line = '{0:o},{1},{2:o},{3},{4},{5},{6},{7},{8}' -f $now, $p.Id, $p.StartTime.ToUniversalTime(), $up, [math]::Round($p.WorkingSet64 / 1MB, 1), [math]::Round($p.PrivateMemorySize64 / 1MB, 1), [math]::Round($p.VirtualMemorySize64 / 1MB, 1), $p.HandleCount, $p.Threads.Count Add-Content -LiteralPath $csv -Value $line } Write-Output ("samples={0} csv={1}" -f $procs.Count, $csv)