我需要在特定进程运行时获取系统的页面错误和磁盘 IO。
我可以获得页面错误但无法获得磁盘 IO:
$arrayDIO = @()
$arrayPf = @()
$cmdProcess = start-process cmd -passthru
while (-not $cmdProcess.HasExited) {
$arrayDIO += %{ (Get-WmiObject Win32_PerfFormattedData_PerfProc_Process).IOWriteOperationsPerSec }
$arrayPf += %{ (Get-WmiObject Win32_PerfFormattedData_PerfOS_memory).PageFaultsPerSec }
sleep 2
}
$arrayPf | Measure-Object -Average -Maximum -Minimum | Out-File -Filepath C:\Details.txt
$arrayDIO | Measure-Object -Average -Maximum -Minimum | Out-File -Filepath C:\Details.txt -append