Quantcast
Channel: VMware Communities : Popular Discussions - Hyperic User Forums
Viewing all articles
Browse latest Browse all 52618

Get CPU time for process?

$
0
0
I am trying to write some benchmarks of a command line application using Java.  I want to run a number of commands using something like ProcessBuilder or Runtime.exec().  After the command completes, I would like to get the CPU time used by the command, as opposed to just the clock time.  If I were doing this only on Linux, I would just use the time command to run the command and then parse the results.  However, I would like to write something that I could also run on Windows.

Can this be done using SIGAR?  Can someone give some sample code?  I know you can get the PID from ProcessBuilder, so I am thinking that I use that to run the command and then use some SIGAR API to find out how much CPU time the process that was created used.  The process will have ended, so I am wondering if this is still possible to do?

Also wondering if SIGAR has its own classes for running a command that maybe incorporate some of this.

Thanks

Mark

Viewing all articles
Browse latest Browse all 52618

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>