Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows command for CPU utilization % for particular service [closed]

Is there any way to get CPU utilization for particular service from a script on Windows? I know wmic cpu get LoadPercentage will give CPU utilization for the entire system, but is it possible to get it for a particular program like winword.exe?

like image 984
user1954762 Avatar asked Jan 08 '13 13:01

user1954762


1 Answers

Yes, it's possible.

This wmic command prints the CPU usage for all processes. Then you can pipe it to findstr to filter for a particular process (using the flag /c:<process name>).

wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime

Do help findstr and help find from the command line to see more ways you can filter the list.

For example:

C:\> wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime | findstr /i /c:chrome
chrome                  24
chrome#1                0
chrome#2                0
chrome#3                0
like image 143
indiv Avatar answered Jan 28 '23 23:01

indiv