473,326 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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
Ra****@Fauske.com

Feb 10 '06 #1
2 2956
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
"ra****@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
Ra****@Fauske.com

Feb 10 '06 #2
Excellent! I tried it and it works!
Thanks so much,
Jim

Feb 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marc | last post by:
Hi all, In searching for an answer to this problem I found several solutions dealing with Unix but none dealing with Windows. Basically I want to send a ping for an indefinite period of time,...
21
by: John Lin | last post by:
Howdy, I want to know how to tell if a forked process is done. Actually, my real question is that I want to run a shell script inside of a python script, and after the shell script has...
0
by: Guy | last post by:
Hi, I created a function, which seems to work, quite well, it tells me if a process is running in widows using the pid number (I'm aware that the pid number in widows is not called a pid and this...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
3
by: felixfix | last post by:
Hi all, I am just wondering if something is wrong with my program. What it bascially does is to output a fibonacci sequence base on the command-line output. If I give a 5, it will generate the...
16
by: LP | last post by:
Hello, I am trying to use .NET with Excel. I installed Office 2003 and selected ..NET programming suport option, so it installed all those PIA, as MS sugests. But I can not find a way to destroy...
0
by: Patrick A. | last post by:
Dll written in VB.NET 2003 to start a command remotely. You can : - launch the command and wait until it's finished. (Ex. 1) - launch the command providing a timeout in seconds, it will wait...
6
by: TyBreaker | last post by:
I am using a performance counter to record the "Elapsed (CPU) time" of the "Idle" process. I record the elapsed time, wait 1 second and then record the new elapsed time. The result I get is: ...
0
by: ravindrag | last post by:
Hi, I am getting error SQL1131N during sqlj.install_jar(...). There is no useful message in the diag.log (even with diag level 4). I am giving the diag.log entries at the end of this posting...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.