By targeting CPU usage well below 100%, you can minimize jitter and ensure that the tasks in your application do not need
to compete for CPU time. Refer to the following guidelines for minimizing CPU usage in your real-time application.
-
Create a time budget to determine the amount of time required to execute each task in the application.
-
Use the Real-Time Trace Viewer to identify which VIs and threads in your application use the most CPU time. You can then adjust
them based on the following guidelines:
-
Run loops only as fast as necessary.
Running each loop in your application as fast as possible can lead to undesired timing behavior, including increased jitter
and even system deadlocks. For example, running the data publishing loop of a user interface faster than the human operator
can process and respond to the data can unnecessarily tax the CPU of the real-time target. In most cases, a rate of 2 Hz to 15 Hz is adequate for a loop that publishes user interface data over the network.
-
Avoid excessive parallelism.
Executing code in parallel can increase performance on multi-core systems, but greater parallelism also leads to greater
overhead, which can impact performance. To determine whether a VI can benefit from parallelism, you might need to benchmark
both the serial form and the parallel form of the VI.
-
Consider offloading certain tasks to either a desktop PC or an FPGA.
Use the following guidelines to determine the most appropriate device for performing specific types of tasks.
Task
|
Appropriate Devices
|
Data acquisition
|
RT or FPGA
|
Control loop
|
RT or FPGA
|
Data analysis for logging or monitoring purposes (offline analysis)
|
RT or Desktop PC
|
Data logging
|
RT or Desktop PC
|