WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

CPU Time of a Process

 Keywords:  CPU time processing process used started Win32_ProcessUserModeTime KernelModeTime CPUTime task manager

CPU time of a process (like that displayed in the task manager):
; CPU time is an indication of how much processing time that the process has used since the process has started
; Developed by ferchl
AddExtender("WWHUG34I.DLL")
Results = ""

oWMI = ObjectGet("winmgmts:")
oCollection = oWMI.ExecQuery("Select * from Win32_Process")

ForEach oProcess In oCollection
   ProcessName = oProcess.name
   USecs = huge_Divide(oProcess.UserModeTime,10000000)
   KSecs = huge_Divide(oProcess.KernelModeTime,10000000)
   CPUTime = Int(USecs + KSecs)
   Hours = CPUTime / 3600
   Minutes = StrFixLeft(CPUTime mod 3600 / 60,"0",2)
   Seconds = StrFixLeft(CPUTime mod 60,"0",2)
   Results = Results:ProcessName:@TAB:Hours:":":Minutes:":":Seconds:@LF
Next

AskItemlist("CPU Time",Results,@LF,@SORTED,@EXTENDED)


Exit

Article ID:   W18242
Filename:   CPU Time of a Process.txt
File Created: 2009:12:03:16:36:18
Last Updated: 2009:12:03:16:36:18