12-22-2015 05:36 PM
Ok, I will try to use as few words as possible to describe my application!
I wrote a wrapper for .NET DLL since it was returning an event source of 0 for call-backs and LabView doesn't respond to those events! Wow, was that a nightmare to figure out! The wrapper just "retransmits" the events. It doesn't even do any configuration of the library!
I'm having an issue where events seem to be buffered when my VI does things with front panel controls. It is strange since it seems one type of event isn't buffered and all of the others are, but that could be my perception.
I have front panel controls that are written to by passing a control reference to the "Reg Event Callback". I have about 30 events per second comming from three sources (90-100 events per second total).
Does anyone have any idea why my events would be "buffered" for up to a few seconds? I can cover the eye tracking sensor and see a playback record of the events! Slowing down could include something as simple as writing to a plot control at about 100 measurements per second. It is especially slow when the X scale is compressing to fill up the whole history. I've noticed that some controls are extremely slow, like sliders. I set the priority to the highest and changed the execution system, but I'm guessing this doesn't impact writing to front panels? I've also tried resizing the window so that the control that the callback is writing to isn't visible (this DOES make a program faster if you are writing fast to a slider) but it didn't change anything.
I've attached some snippets and my wrapper.
"Callback.png" is my callback function. All of the vis in it only include a few multiply/divide functions.
"Register.png" is how I register for the event and it shows the control that the call-back writes to.
"Program.png" is what my program does after registering for all of the events!
I will have to reply to this thread with the wrapper. Not enough attachments left!
12-22-2015 05:46 PM
Attached is my wrapper. I have two functions that setup the DLL, but the rest of them just pass events and values!
Labview never takes more than 10-15% of the CPU even when the events are being significantly delayed.
Should I write all of the event data to a global variable and then read the global variable in my loop for a visual diagnostic?
12-22-2015 09:47 PM
I don't know why I called it a "plot", but what I was running was a "Waveform Chart" with a history of 6000.
When I run this vi while the other one is receiving events the event VI will slow down to about 50% and events will stop comming in.
Labview never takes more than 15-20% while running both VIs.
Also, I found other resources:
- Describes differences between front panel items, local variables, and property nodes
http://digital.ni.com/public.nsf/allkb/74ECB57D3C6DF2CE86256BE30074EC47
- VI speed, I could inline the simple math VIs in my call-backs
http://zone.ni.com/reference/en-XX/help/371361K-01/lvconcepts/vi_execution_speed/
- someone here mentioned that the property node is 600 times slower than? a global variable?
http://ideasinwiring.blogspot.com/2006/03/performance-impact-of-property-nodes.html
I guess I have some ideas on what to do, but I can't figure out why it appears that one event is not buffered and all of the others others are??? : (
12-22-2015 11:50 PM
I decided to do a simple test. I am pretty surprised!
The most surprising result was that writing to a global variable was a hair faster than an indicator! I'm not using property nodes anymore! : )
These tests were done on a Microsoft Surface Pro 3.
I'm still interested in finding out what other people have to say. I hope something here can be useful to someone else!
100000 Loops Writing to Property Node - 14,227ms
100000 Loops Writing to Indicator Only - 10 - 11ms - Same when Off Screen!!!
100000 Loops Writing to BOTH - 22,056ms
100000 Loops Writing to Global Variable - 13-15ms
100000 Loops Writing to Global and Indicator - 21 - 25ms
100000 Loops Writing to Global and Indicator with the Global Variable "VI" Closed - 13-18ms
100000 Loops Writing to Global Variable with the Global Variable "VI" Closed - 7 - 9ms
100000 Loops Writing to Global and Property - 14,337ms
100000 Loops Writing to All THREE - 21.771ms
12-23-2015 12:30 AM
I deleted all of the property node writing, replaced the user data control with a generic variant, and passed data to a global variable.
Then in my main program I read the global variables every 30ms (changed it from 5!) and write them to the front panel for a diagnostic view.
I can't bog it down any more. The events aren't buffered any more. It was hard for me to accept this because of the 8 events 1 was never delayed!!!???
Any comments are welcome, but I'm pretty sure my problem is fixed!