4
我需要在特定進程運行時獲取系統的頁面錯誤和磁盤IO。獲取磁盤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