tags:

views:

97

answers:

4

Hi All,

Is there any command or possible way to know the cpu utilization in windows operating system

+1  A: 

From the command line? Have a look at PsList in the PsTools suite.

AffineMesh94464
+2  A: 

To monitor at 1 second intervals use:

typeperf "\processor(_total)\% processor time"

For only the current usage, use:

typeperf -sc 1 "\processor(_total)\% processor time"
mcstellar
+2  A: 

here's a little vbscript that shows cpu utilization for each process

strComputer ="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_PerfProc_Process",,48)
For Each obj in colProcess
If obj.Name <> "Idle"  And obj.Name <> "_Total" Then 
        WScript.echo obj.Name & "," & obj.PercentProcessorTime
End If
Next

save as showcpu.vbs and run it on the command line as

c:\test> cscript //nologo showcpu.vbs 
ghostdog74
A: 

To determine the usage in general, you can use mcstellar and warren's answer. You also have the option of:

List all processes:

typeperf "\Process(*)\% Processor Time" -sc 1

List all processes, take 5 samples at 10 second intervals:

typeperf "\Process(*)\% Processor Time" -si 10 -sc 5

If you want a specific process, Rtvscan for example:

typeperf "\Process(Rtvscan)\% Processor Time" -si 10 -sc 5

I found it extremely useful to just monitor all process activity over a period of time. I could then dump it to a csv file and filter in a spreadsheet to remotely diagnose issues.

The following gives me 5 minutes (at 10 second intervals) of all processes. The data includes not just % Processor Time, but IO, memory, paging, etc.

typeperf -qx "\Process" > config.txt typeperf -cf config.txt -o perf.csv -f CSV -y -si 10 -sc 60

Keith M.