10-03-2014 08:22 AM
Recently a VI I've been working on for quite some time has begun running slowly. A large delay (5-7 seconds) occurs after I connect to my target hardware before the VI continues processing. I'm trying to figure out why, so I've made a copy of my project and have begun deleting some tabs with lots of indicators in an effort to track down the specific cause.
That didn't work, so I tried pausing program execution during the delay. I expected to see it highlight in an active area of code, but instead this is what showed up on the block diagram:
The outer black edge blinks during paused execution. A separate time I did this, there was much smaller black box in the lower right corner...in other words, between those 2 times, it's as though it's highlighting on a loop with a stop control in the lower right.
Notice also that the horizontial and vertical scroll bars are all the way at their extremes. This is an area of the block diagram I'm not using at all. In other words, if I manually scroll to this same area of code, there's nothing there. In other other words, it's as though program exeuction is stopping and highlighting an area of code that is not even visible.
I know it's possible to hide front panel objects, but is it possible that there is block diagram code that is hidden? What can I do to figure out what it is that is being highlighted as shown above when I hit pause?
Thanks in advance.
Solved! Go to Solution.
10-03-2014 09:22 AM
You can do a block diagram cleanup (but don't save) to see ifanything was hidden. I'd do this especially if I inherited code. I've seen subVIs hidden behind case structures and stuff like that.
10-03-2014 09:23 AM
this indeed was inherited...I will try and get back with you
10-03-2014 09:32 AM
ok, I think that process did indeed uncover a couple of loops...however, I have no idea how to find them in the code before cleaning up the block diagram and as you can imagine, executing 'clean up' gets things so out of whack it would take me forever to restore manually.
In other words - any idea how I can find this stray code? I'm surprised it even compiles...the stray code that I found was a loop with what appeared to be disconnected wires....or at least, I made the loop bigger and bigger and never found them attached to anything...no errors when I deleted the entire loop though.
10-03-2014 10:11 AM
I think you can single step through the VI and when it is highlighted, abort the VI. It should stay highlighted. Then use the order button to bring it to the front.
10-03-2014 10:14 AM
unfortunately I had tried something like that already...the problem is that it doesn't stay highlighted when I abort execution...
10-03-2014 10:30 AM - edited 10-03-2014 10:31 AM
You can use Ctrl+Shift+n to see if anything exists out of the visible area and you can use VI Analyzer to see if there is hidden code. I never use VI Analyzer so I couldn't figure out what I really wanted, but it'll highlight catch wires running under stuff.
10-03-2014 11:00 AM
OK, using a combination of suggestions, I think I've gotten it....I found some of the offending code that was slowing my program down too, so that's good. Thanks!
10-03-2014 11:39 AM
Hmmm, maybe we need a new term for this. Technically you could call it obfuscation, but maybe a btter term would be "code occultation." 😉
10-03-2014 11:41 AM
I'm still confused as to how my code was compiling...hidden or not, the loop that showed up when I executed "clean up" had wires that didn't go anywhere...yet they were solid colors (instead of dashed lines like when you have a broken wire)...