April 28th, 2013

PowerTip: Use PowerShell to Find Total CPU Time

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to find the total CPU time of a process.

Hey, Scripting Guy! Question How can I return a timespan that represents the total CPU time of a process?

Hey, Scripting Guy! Answer Use the Get-Process cmdlet and select the TotalProcessorTime property:

PS C:\> (gps excel).totalprocessortime

 

Days              : 0

Hours             : 0

Minutes           : 0

Seconds           : 4

Milliseconds      : 524

Ticks             : 45240290

TotalDays         : 5.23614467592593E-05

TotalHours        : 0.00125667472222222

TotalMinutes      : 0.0754004833333333

TotalSeconds      : 4.524029

TotalMilliseconds : 4524.029 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.