|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to use Process ID (PID) to get elapsed CPU time?I have a Process ID (PID) and want to continually query how much elapsed CPU time that process has used. How can I do that? Here is how I get my PID: Dim myproc,TheProcTime myproc = New System.Diagnostics.Process MyProcID = myproc.Start("c:\run27.exe", "c:\input.ini") For 1 instance, I can find the CPU time elapsed by: TheProcTime = MyProcID.userprocessortime.totalseconds BUT, I cannot get this value to update with the process running. What do I need to do to update this value? Thanks, Jim Rai***@Fauske.com Jim,
You need to call the process's Refresh method in order to see new userprocessortime values. You could use a timer to get and display the new value for as long as the process was running. Kerry Moorman Show quoteHide quote "rai***@fauske.com" wrote: > HI: > > I have a Process ID (PID) and want to continually query how much > elapsed CPU time that process has used. How can I do that? > > Here is how I get my PID: > > Dim myproc,TheProcTime > myproc = New System.Diagnostics.Process > MyProcID = myproc.Start("c:\run27.exe", "c:\input.ini") > > > For 1 instance, I can find the CPU time elapsed by: > > TheProcTime = MyProcID.userprocessortime.totalseconds > > BUT, I cannot get this value to update with the process running. > > What do I need to do to update this value? > > Thanks, > Jim > Rai***@Fauske.com > > |
|||||||||||||||||||||||