LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick Drop for Timing VIs

Hey All,

 

It was a slower week for me so I got to spend a bit of time exploring one of my favorite areas of LabVIEW, VI Scripting.  I ended up making a Quick Drop shortcut that I wanted to post to get feedback for future improvements and to give people another tool that might help them out.

 

This Quick Drop command will let you time any portion of your VI that you select on the Block Diagram using a three frame stacked sequence structure with tick count (ms) for timing.  If you wanted to time the generation of random numbers, the goal would be what is shown below.

 

Timing Goal.JPG

 

I attached the quick drop plugin to this post.  If you want to try it out for yourself you can download the VI and save it to C:\Program Files (x86)\National Instruments\LabVIEW 2014\resource\dialog\QuickDrop\plugins, the plugin defaults to Ctrl-F.

 

To use this QD command you first select what you want to time the execution rate of.  In this case, we will time a for loop generating 100 random numbers.

Timing QD 1.pngTiming QD 2.png

Once you have selected what you want to time, simply press Ctrl-Space to bring up the Quick Drop menu and Ctrl-F to drop your timing sequence.

Timing QD 3.png

It's definitely not as pretty as what I would like, and if I have time to work on this in the future I would focus on improving the resulting look of the script.  At the very least, I would want to move the timing VIs and subtraction to the bottom of the frame and see if I can implement a Ctrl+Click+Drag of sorts to make sure whatever is created does not overlap what you already have.

 

I would be glad to answer any questions or save for a previous version, and any feedback would be greatly appreciated.

 

Matt J | National Instruments | CLA
Message 1 of 8
(2,856 Views)

You can also use the timed sequence, which is a pain, but might be less so if you script it - http://forums.ni.com/t5/LabVIEW/Community-Nugget-05-27-2009/m-p/1137228#M501103

 

I also posted a similar plugin to the RCF group some years ago. If I remember correctly, it was a rush job, so it's probably not any cleaner than yours, but you could try looking at it.


___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(2,796 Views)

I have never seen a timed sequence structure used for that purpose.  Is there a particular reason why this method of timing is not used as much?

 

I knew the timing sequence strcuture existed but to be honest I can't think of a time I've seen it used in a VI.

Matt J | National Instruments | CLA
0 Kudos
Message 3 of 8
(2,746 Views)

I know everyone hates stacked sequences, but is there a reason to not use them here?  When I do timing things like this I'll use a stacked sequence with the same 3 states.  It takes up less space, and mentially we know there is only one function in the case 0 and case 2, getting the new time.

 

Also I'd suggest using the micro second timer found in the hidden gems (in the vi.lib) to get more precision.

 

And lastly most of the time I want to know about timing, I just use the error wires and a probe like this 

 

https://decibel.ni.com/content/blogs/EvanP/2010/10/04/simple-sexy-labview-timing-probes

 

Of course that requires the data flow of error terminals.  And the simple timing method is more accurate, but when I'm debugging larger applications we aren't talking about comparing microseconds, we are trying to figure out why a UI locked up loading a file, and figuring out which step in the load took the longest.

0 Kudos
Message 4 of 8
(2,744 Views)

Nice plugin, Matt. A few comments:

 

1. Can you post your next update on the Quick Drop Enthusiasts group? And after you post it, update the list of community plugins?

2. Re: the Timed Sequence discussion above, I was discouraged by the designer of the Timed Sequence from using it for benchmark purposes, because its manipulation of thread priorities can skew the actual execution time of the code being benchmarked when compared to its normal execution outside a Timed Sequence.

3. The High Resolution Relative Seconds VI that Hooovahh refers to was added to Quick Drop/palettes in LabVIEW 2014. I agree with his recommendation to use this VI over Tick Count.

0 Kudos
Message 5 of 8
(2,727 Views)

@Darren wrote:

 

2. Re: the Timed Sequence discussion above, I was discouraged by the designer of the Timed Sequence from using it for benchmark purposes, because its manipulation of thread priorities can skew the actual execution time of the code being benchmarked when compared to its normal execution outside a Timed Sequence.

 


 

This is an interesting point that I had not thought about.  I'm not sure how much of a difference it would end up having on most occasions but it is probably best not to deal with that uncertainty at all.

 


 

3. The High Resolution Relative Seconds VI that Hooovahh refers to was added to Quick Drop/palettes in LabVIEW 2014. I agree with his recommendation to use this VI over Tick Count.

 


A good suggestion by both of you and something that should be really easy to change.

 

Side Question: Any idea why Flat Sequence Structures do not inherit from Structures? This bugged me quite a bit.

Matt J | National Instruments | CLA
0 Kudos
Message 6 of 8
(2,715 Views)

Jacobson wrote: 

Side Question: Any idea why Flat Sequence Structures do not inherit from Structures? This bugged me quite a bit.


I'm not sure I had a full answer but I know AQ posted something on the forums when I asked a similar question.  I can't seem to find it at the moment, but I assume it bugs plenty of people.

0 Kudos
Message 7 of 8
(2,708 Views)

@Jacobson-ni wrote:
Side Question: Any idea why Flat Sequence Structures do not inherit from Structures? This bugged me quite a bit.

Structures are nodes, they execute after all of their inputs are available.

 

The FSS, for better or worse, is not a node.  It is syntactic sugar for a series of nodes.  Each frame of the FSS executes when its inputs are ready, without regard for later frames.  It executes as if you have chained a series of single frame structures.  That is why it is not a structure.

Message 8 of 8
(2,695 Views)