How to use Process ID (PID) to get elapsed CPU time?

R

raines

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
(e-mail address removed)
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top