LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Difference Between Getting CPU from System Resource vs. RT Get CPU

Hi,

 

I was wondering what is the difference between getting the CPU load from System Resource -> CPULoadTotal and getting the CPU from RT Get CPU Loads? 

 

Best,
Pegah

0 Kudos
Message 1 of 15
(3,822 Views)

RT Get CPU Loads is the old method that was introduced when NI first implemented LabVIEW Realtime on Pharlap targets. They created a small DLL that exported many low level functions to access "internal" OS features for monitoring and things like changing the RTC. When they moved to VxWorks as realtime OS they created a compatible shared library interface that implemented some of these functions so the same VIs could be used on those targets too. When moving to Linux RT as new OS for realtime targets they decided that this was a hard to maintain solution across various very different OSes and instead implemented a completely new API that was designed to work across all OS versions including Windows, MacOS X and Linux and the RT targets. This is the NI System Configuration API and it is the new way to access this information uniformally on all the systems LabVIEW can run on.

It works locally as well as remotely, so you can query information on a remote system if both have the NI System Configuration API installed and the permissions are set such to allow that. And you do not need to make conditional code anymore to query such information if your VI is meant to run both in your desktop application as well as in your RT target.

The downside is that the NI System Configuration API is object oriented and kind of complex to use for fairly simple things but it is much more flexible, has a lot more possibilities, is fully cross platform and allows remote query of systems. The only thing you need to make sure is that all the systems you want to access in this way, locally and remotely, need to have the NI System Configuration API installed.

Rolf Kalbermatter
My Blog
Message 2 of 15
(3,786 Views)

To me it seems that the two are different in a sense that RT Get CPU returns the LabVIEW CPU usage; however, the System Configuration's CPU gives me the OS CPU. So my understanding is that there must be a difference between the two and I would like to understand exactly what that difference is.

0 Kudos
Message 3 of 15
(3,760 Views)

And what in this documentation makes you believe that?

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 15
(3,753 Views)

Nothing in the document. I have tested both and I do not get the same CPU value from the two approaches. That is why I would like to know the difference between the two.

0 Kudos
Message 5 of 15
(3,727 Views)

So show us your data!

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 15
(3,721 Views)

I have attached the CPU readings by the two approaches and graphed them. The plot shows how the two readings are different. The biggest difference is at the beginning of the run and along the way they are reporting different CPU loads. 


I have also attached my code if needed.

Download All
0 Kudos
Message 7 of 15
(3,703 Views)

It would seem that on average the values are pretty similar, but the RT Get CPU version does some aggregation/averaging over a certain period while the Sys Resource one is a lot more noisy. Still I do not see a significant difference if you look at the average over a longer time interval.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 15
(3,696 Views)

If the only difference is averaging how is it that at the beginning there is such a big difference in the CPU loads between the two methods?

 

To me it seems that RT Get CPU could be the LabVIEW RT Load while System Resources is the OS CPU Load or something like that and I would like to understand that difference.

0 Kudos
Message 9 of 15
(3,675 Views)

@pegahm wrote:

 

To me it seems that RT Get CPU could be the LabVIEW RT Load while System Resources is the OS CPU Load or something like that and I would like to understand that difference.


That's not logical. If that would be the case there would need to be a more significant difference even after the initial startup peak for the application. But they look very similar in average. And if you consider averaging then the initial peak gets of course flattened out through averaging too.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 15
(3,669 Views)