CPU checks in windows-commandline

CPU load on serevr
——————-
c:\>wmic cpu get loadpercentage
LoadPercentage
0

or

C:\>@for /f “skip=1″ %p in (‘wmic cpu get loadpercentage’) do @echo %p%
4%

on remote machine
wmic /node:”serevrname or IP” /user:IP\username cpu get loadpercentage

Get CPU usage on server
———————–
C:\Windows\system32>typeperf “\Processor(_Total)\% Processor Time”

“(PDH-CSV 4.0)”,”\\vm\Processor(_Total)\% Processor Time”
“02/01/2012 14:10:59.361″,”0.648721”
“02/01/2012 14:11:00.362″,”2.986384”

Typeperf :-Writes performance counter data to the command window, or to a supported log file format. To stop Typeperf, press CTRL+C.

current usage
————–
typeperf -sc 1 “\processor(_total)\% processor time”

List of all process
——————–
typeperf “\Process(*)\% Processor Time” -sc 1

If you want a specific process, Rtvscan for example:

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

collecting 20 samples to a csv file
———————————–
Typeperf “\Processor(_Total)\% Processor Time” -sc 20 -o c:\users\win7\desktop\Report.csv

Save to a file
————–
typeperf “\Processor(_Total)\% Processor Time” -o CpuUsage.csv

OR

typeperf “\Processor(_Total)\% Processor Time” >> CpuUsage.csv

Processor Information
———————-
wmic cpu get caption
Caption
x86 Family 6 Model 37 Stepping 2
x86 Family 6 Model 37 Stepping 2

We can get process information using system environment variables also. The environment variables related to CPU are listed below.

PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION

C:\>echo %PROCESSOR_ARCHITECTURE% %PROCESSOR_IDENTIFIER% %PROCESSOR_LEVEL% %PROCESSOR_REVISION%
x86 x86 Family 6 Model 37 Stepping 2, GenuineIntel 6 2502

Info about your system’s BIOS, current version and it’s serial number
——————————-
C:\>wmic bios get name,serialnumber,version
Name                                    SerialNumber  Version
Phoenix ROM BIOS PLUS Version 1.10 A04  5xyz6BS       DELL   – 15

Motherboard (that happen to be the name) and it’s UUID
——————————————-
wmic csproduct get name,identifyingnumber,uuid

CPU clock speed
—————-
wmic cpu get name,CurrentClockSpeed,MaxClockSpeed

Clock speed every 1 second
————————–
wmic cpu get name,CurrentClockSpeed,MaxClockSpeed /every:1

Cache sizes of the CPU
———————-
C:\>wmic cpu get L2CacheSize, L2CacheSpeed, L3CacheSize, L3
CacheSpeed
L2CacheSize  L2CacheSpeed  L3CacheSize  L3CacheSpeed
2048                       0            0

Get process and percentage process time
—————————————
> wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime

LOad % every 5 sec
——————
C:\>wmic cpu get loadpercentage /every:5
LoadPercentage
3
LoadPercentage
3
LoadPercentage
10

Powershell command
——————
Get-WmiObject Win32_Processor

Any Task runing morethan 10 sec
——————————-

C:\>tasklist /FI “CPUTIME gt 00:00:10”

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0         24 K
csrss.exe                      344 Services                   0      3,300 K
csrss.exe                      408 Console                    1     15,836 K
services.exe                   504 Services                   0     10,408 K

Tasklist usage
————–
TASKLIST [/S system [/U username [/P [password]]]]
[/M [module] | /SVC | /V] [/FI filter] [/FO format] [/NH]

Name of the running process is “iexplore”
—————————————–
C:\>wmic path win32_perfformatteddata_perfproc_process wher
e Name=”iexplore” get Name, Caption, PercentProcessorTime, IDProcess /format:lis
t

or

C:\>wmic path win32_perfformatteddata_perfproc_process wher
e (Name=’iexplore’) get Name, Caption, PercentProcessorTime, IDProcess /format:lis
t

Caption=
IDProcess=8068
Name=iexplore
PercentProcessorTime=0

Name of the running process
—————————
C:\>wmic path win32_perfformatteddata_perfproc_process get
Name, Caption, PercentProcessorTime, IDProcess /format:list

Caption=
IDProcess=21908
Name=COH64
PercentProcessorTime=0

Caption=
IDProcess=24372
Name=COH64#1
PercentProcessorTime=0

Caption=
IDProcess=0
Name=_Total
PercentProcessorTime=100

Monitor a process named test.exe
———————————

Click on Start, Run, and enter “perfmon”
Click on Performance Logs and Alerts
Click on Counter Logs
Right-click Counter Logs
Click New Log Settings
Enter a log name that makes sense, e.g., Monitor Test.exe CPU
The Counter Log configuration dialog opens
On the General tabl, click Add Counters..
Click “Use local computer counters”
Choose Process for Performance Object
Select % Processor Time for Select counters from list
Select Test from Select instances from list
Click Add
Click Close
For Interval, choose something logical, such as 15 minutes
Click the Log Files tab
Choose a Log File Type of “Text File (Command delimited)”
Choose the file destination directory in Location
Click Ok
Determine whether (and how) you want the log file to rotate with “End file names with..”
Click Ok

Advertisements

Posted on May 23, 2014, in Windows. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: