LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows CVI 2015 SP1 on Windows 10 Pro - High CPU Usage

Solved!
Go to solution

Hello,

 

I have a fresh installation of Windows 10 Professional 64bit on my Laptop. I have installed LabWindows CVI 2015 SP1 and the following NI software also.

 

image.png

 

I have observed that my CVI applications consumes high CPU when run in both debug or release mode. So i thought of doing some bench marking. I ran the simple.cws (National Instruments\CVI2015\samples\utility\Threading\Simple\Simple.cws) example from the example finder, which is a program to demonstrate multi threading in LabWindows CVI. The program has two threads running at rate of 0.5s and 10ms respectively. It was found that this program would consume around 38% cpu. Is it normal ? Can someone try to test it on your pc with windows 10 64bit. Below is the screenshot showing cpu usage.

image.png

Has anyone faced similar issue or does anyone know of a solution?.

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 1 of 3
(2,647 Views)
Solution
Accepted by topic author djac91

I have some notes on this scenario:

 

1. CVI sleep policy can heavily impact on system performances; this option can be found in Options >> Environment... dialog or programmatically set by calling SetSleepPolicy () function. This parameter should be set carefully set depending on your scenario. In a typical environment in which critical tasks are demanded to indipendent threads and the user interface is handled by the main thread, I have found that setting the general option to "Sleep more" and setting individual threads to "Sleep some" or "Do not sleep" guarantees the best system efficiency. Your threads, of course, need to be carefully programmed to use as less CPU time as possible

 

2. In a multithreaded environment I strongly suggest to use SDK Sleep () function instead of Delay (): as described here, Delay () is a busy wait with a heavy impact on system performances. On my system, CPU usage drops down from 40 to 6% when running your example with Sleep instead of Delay in thread functions. To use Sleep () you must include windows.h before any other included file in your code



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(2,625 Views)

Many thanks Roberto..That solves the problem. The usage is only 6 to 7% now. Smiley Happy

-----------------------------------------------------------------------------------------------------------------------------
Waiting For the inner calling 🙂


0 Kudos
Message 3 of 3
(2,623 Views)