• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 686
  • Last Modified:

Process.Start Get CPU Time

I'm using a C# .net program (using MONO on RHEL) to invoke the a external process, I'm looking to monitor the process by checking the CPUtime at a defined interval, if the CPU time has not increased I assume the process is dead, kill it off and move on to the next stage. However when I get the CPU time (after a Process.Refresh) it is always 0 are the CPU times not populated on mono or am I missing something?
0
McExp
Asked:
McExp
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
I have not messed with Mono much as of yet, but the typical way of starting a process and waiting for it to finish in .NET would be:
Process p = new Process();
ProcessStartInfo info = new ProcessStartInfo("/bin/file_to_execute", "list of arguments");

p.StartInfo = info;
p.Start();
p.WaitForExit();

Open in new window

0
 
McExpAuthor Commented:
Please read my question again, I already have the code working to load the process and monitor the CPU time for the process, However whenever I call the code I get a return of 0 ms. Your example doesn't even propose a solution to do check of CPU time. Please only respond if you can actually help!
0
 
DragonWolfCommented:
Looking at the mono source, Refresh doesn't look like it does anything for the TotalProcessorTime

The TotalProcessorTime method calls a Times method in an assembly specific for your operating system, I've not been able to track down the source for this yet and unfortunately have run out of time. If you've got no answer by tomorrow I'll try and track it down further. Sounds like you may need to raise this with the mono team though.
0
 
käµfm³d 👽Commented:
Good luck.
0
 
McExpAuthor Commented:
I've reported the "Bug" let's see what happens!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now