Hoeloeloe Posted March 9, 2007 Report Share Posted March 9, 2007 Hi, At the moment I'm developing a program for data acquisition from a digital scope. It consists of a dll provided by the scope manufacturer, and a graph which displays it. The VI runs a loop and gets its data through the DLL from the scope. When running the program it uses a 3-10% cpu power (on winxp) but when I use the right mouse button on one of the controls in the VI the cpu usage goes up to ~50% and the data acquisition speeds up a lot. How can i make the program to run always this fast? as speed is rather crucial for this project. Or if it aint possible, what is the reason the right click speeds up everything. Thanks Quote Link to comment
LV-Vikingr Posted March 9, 2007 Report Share Posted March 9, 2007 Hello Hoeloeloe, An increase in CPU usage does not necessarily mean that the program is running faster. Most likely, right clicking on a control is causing other events to occur which require more CPU power. Also, you might want to clock the time it takes for one iteration of the loop to complete. Have that display somewhere on the screen and watch the speed (in ms) while it runs and while you right click on a control. I'm sure that the speed will decrease or stay the same. It might also help to see a sample of your code... Quote Link to comment
Mellroth Posted March 10, 2007 Report Share Posted March 10, 2007 QUOTE(Hoeloeloe @ Mar 8 2007, 02:51 PM) The VI runs a loop and gets its data through the DLL from the scope.When running the program it uses a 3-10% cpu power (on winxp) but when I use the right mouse button on one of the controls in the VI the cpu usage goes up to ~50% and the data acquisition speeds up a lot. How can i make the program to run always this fast? Without any actual knowledge of your code, it sounds as if you are sampling in the same VI that graphs the data? If this is the case, it means that your data acquisition is taking place in the same thread as the UI, and is therefore affected by events like the Mouse clicks/window dragging etc. To speed up your acquisition you could put the data acquisition loop in a SubVI (possibly setting this subVI to use another thread), then post data from the data acquistion loop to the UI loop using a queue. Have a look at the Producer/Consumer design pattern at NI http://zone.ni.com/devzone/cda/tut/p/id/3023''>http://zone.ni.com/devzone/cda/tut/p/id/3023' target="_blank">http://zone.ni.com/devzone/cda/tut/p/id/3023 To get more info, I think you'll have to post an example VI, so that we can see what you are trying to achieve. /J Quote Link to comment
Hoeloeloe Posted March 10, 2007 Author Report Share Posted March 10, 2007 QUOTE(LV-Vikingr @ Mar 8 2007, 05:17 PM) Hello Hoeloeloe,An increase in CPU usage does not necessarily mean that the program is running faster. Most likely, right clicking on a control is causing other events to occur which require more CPU power. Also, you might want to clock the time it takes for one iteration of the loop to complete. Have that display somewhere on the screen and watch the speed (in ms) while it runs and while you right click on a control. I'm sure that the speed will decrease or stay the same. It might also help to see a sample of your code... First of all, thanks for replying. Ok I added a millisecond counter. When normally running the program it says it takes about 60-100 ms for one loop. When pressing the right mouse button on the graph or a control the counter goes down to 2-5 ms for one loop. So something happens for sure QUOTE Without any actual knowledge of your code, it sounds as if you are sampling in the same VI that graphs the data? If this is the case, it means that your data acquisition is taking place in the same thread as the UI, and is therefore affected by events like the Mouse clicks/window dragging etc. Youre right. I will have a look into the producer/consumer for displaying the data. But the same thing happens even when the graphs are removed from the VI EDIT: After restarting Labview the problem is gone for some time. So maybe it occurs only during development. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.