LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor Number of Reentrant Clones

I have an application where I dynamically launch clones of a reentrant VI as needed as commands come into my application.  As other commands are received in my application these clones will be stopped and closed, so each clone will be running for a finite, variable amount of time.  And there could be any number of clones simutaneously running at any given time.

 

For troubleshooting purposes, I want to be able to (a) monitor the number of clones that are running at any given time and (b) open a given clone VI so I can probe, set breakpoints, etc. for a specific clone running.

 

Is there a way with VI server to accomplish this?  The only method I could think of off the top of my head was to attempt to open a VI reference for each possible VI clone name, incrementing the clone number portion of the name until I detect that it is running (see Snippet below).

 

OpenVIClone.png

0 Kudos
Message 1 of 6
(3,897 Views)

why not put in a functional global counter dirrectly in the reentrant vi.  On first call increment this count (this will count the first time the reentrant vi is called for each instance) - small overhead.  allow a mode of operation to read the count stored in the functional global.  Remember to reset this count at the beginning of the application before the first instance is spawned.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 2 of 6
(3,884 Views)

you can also implement teh reset automatically by adding a first call inside of your counter to reset the count at the global first count in an application.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 6
(3,881 Views)

Yea that's a good thought Paul, I could also store each clone VI's reference in that same FGV and then be able to retrieve it later to do any needed debugging.

 

thanks,

Quintin

 

 

0 Kudos
Message 4 of 6
(3,839 Views)

The two methods described here are really the only way to keep track of clones.  Guess the maximum number you'll find (like posted incrementing after the colon), or keep track of the references your self.  There is no "Get All VIs in Memory Including Clones" property yet.  One thing to know is that the maximum guess might not always work as you expect, because in some cases the clone number doesn't always use closed clones.  Say you launch 100 clones, then 50 of them close, then you open another 50, the maximum value might be 150, or it might be 100 (where the closed numbers are reused).  So really the best method is by keeping track of the "This VI" references.

Message 5 of 6
(3,827 Views)

Thanks Hooovah, yes I think the best method is to use a FGV and keep track of the references manually instead of always guessing what the current clone count is.

0 Kudos
Message 6 of 6
(3,788 Views)