From: jrallen9 <jus...@te...> - 2010-06-16 22:44:56
|
I think there is a logic flaw in your test case. The program you've written is I/O bound on the output to the display. The CPU has far more throughput then the buffers present for stdout. You might want to do a comparison by getting the overall system utilization from the CpuPerc class. Use the Sigar.getCpuPercList() to do a summation calculation from the array of CpuPerc (Intel Gulftown processors can have up to 12 logical cores). Use 1 - Idle formula to get the overall system CPU load. Compare the above busy calculation to the ProcCpu values. They should be roughly similar. Another possibility is to run a computationally intensive program like Prime95 or equivalent on the system, take note of the PID using taskmanger or the ps command on linux and use that as the PID for your program. My development has shown the SIGAR code CPU values are accurate. |