06-20-2006 05:16 AM
06-20-2006 08:17 AM
Before considering how the cpu monitor works, I am curious... In your while loop, do you have a delay? If not, try placing a delay even as small as 10ms (actually Dennis recommended a value as small as 0ms). This will free up the cpu momentarily (for other tasks, etc) and may appear to improve performance.
JLV
06-20-2006 10:54 AM
08-16-2006 02:23 PM
08-17-2006 01:27 AM
I used a simple way to estimate it : before starting the application, I just perform some calculations in a for loop 1000000 times and I measure the time spent doing that (using tick count function before and after the loop). This duration is taken as reference for 0% CPU usage (Tref).
Inside my application, I have a while loop running all the time but with a VI in background priority, performing the same calculations as initially (the loop with 1000000 cycles). Time needed to compute the operations, in parallel of the rest of the application is stored in Tcurr. CPU load is estimated by doing (1-Tcurr/Tref)*100.
I compared this estimation with the value given by the real time system manager : it does not match exactly, but they are quite similar.
Please note that when running this while loop forever, it leads to monitoring 100% CPU activity through the real time system manager, but actually, when VIs in my application need to execute, there is no problem since my CPU estimation VI has background priority. Nevertheless, I perform this estimation only every 100ms, because I felt it had negative impacts on controller system tasks (buid-in FTP server for example).
If there is any other solution to retrieve the CPU load, like a system function available in Pharlap, I also would be interested to know it.
Hope it helped.
05-14-2007 12:41 PM
05-14-2007 02:48 PM