PowerShellでCPUコア毎のCPU使用率を確認する †Win32_PerfFormattedData_PerOS_Processorクラスを使用して、CPUコア毎のCPU使用率を確認する方法を以下に記します。 関連記事 †Win32_PerfFormattedData_PerOS_ProcessorからProcessorTimeを取得する †以下のコマンドにより、PercentProcessorTimeを取得することができます。 PS C:\> Get-WmiObject Win32_PerfFormattedData_PerfOS_Processor | Select-Object Name, PercentProcessorTime Name PercentProcessorTime ---- -------------------- _Total 14 0 5 1 17 2 29 3 5 見た目が悪いので Format-Table -AutoSizeを使います。 PS C:\> Get-WmiObject Win32_PerfFormattedData_PerfOS_Processor | Select-Object Name, PercentProcessorTime | Format-Table -AutoSize Name PercentProcessorTime ---- -------------------- _Total 4 0 0 1 5 2 11 3 0 各種PercentTimeを確認してみる †PercentProcessorTime以外にも、以下の情報が取得できます。(各項目の内容については割愛します。) PercentC1Time PercentC2Time PercentC3Time PercentDPCTime PercentIdleTime PercentInterruptTime PercentPrivilegedTime PercentProcessorTime PercentUserTime 以下に一例を記します。 PS C:\> Get-WmiObject Win32_PerfFormattedData_PerfOS_Processor | Select-Object Name,PercentIdleTime,PercentInterruptTime,PercentPrivilegedTime,PercentProcessorTime,PercentUserTime | Format-Table -AutoSize Name PercentIdleTime PercentInterruptTime PercentPrivilegedTime PercentProcessorTime PercentUserTime ---- --------------- -------------------- --------------------- -------------------- --------------- _Total 93 1 2 2 0 0 93 0 0 0 0 1 91 5 5 5 0 2 93 0 5 5 0 3 96 0 0 0 0 各コアとTotalのCPU使用率情報が取得できます。 以上、PowerShellでCPUコア毎のCPU使用率を取得する方法でした。 |