12-11-2024 03:25 PM
I'm looking to get a list of all the VIs in memory. The following works fine.
However, I would also like to see the clone instances that I start using the "run" method. The call
doesn't seem to do this. Is there another method that will get everything running (including the clones)? I'm assuming I'm either missing something, or LV simply won't let me do this. Does LV consider them other application instances or something?
12-11-2024 04:23 PM - edited 12-11-2024 04:36 PM
Hi joshua,
The VI clone names are not officially accessible from the application instance, but you can sort of work this around by generating clone names yourself using this VI: "<LabVIEW>\vi.lib\VIServer\Generate Clone Name.vi".
For each VI listed by App.AllVIs, you could check whether it is reentrant (VI property Execution > Is Reentrant), then generate e.g. the first 100 clone names and try to open them by reference. The only downside is that you don't known how many there will be, so you have to choose a fixed limit. Also, fixing the limit too high will take a lot more time because "Open VI Reference" is not fast at checking whether the VI exists in memory or not.
P.S.: Not sure that will change anything, but you can still kudo this idea:
Regards,
Raphaël.
12-11-2024 06:12 PM
Can you explain why you are trying to do this?
It may be that there's an alternate way to do what you want, but by focusing only on the "App.AllVIs" property and not your general task, we can't suggest anything else.
12-11-2024 06:14 PM
@raphschru wrote:
Hi joshua,
The VI clone names are not officially accessible from the application instance, but you can sort of work this around by generating clone names yourself using this VI: "<LabVIEW>\vi.lib\VIServer\Generate Clone Name.vi".
For each VI listed by App.AllVIs, you could check whether it is reentrant (VI property Execution > Is Reentrant), then generate e.g. the first 100 clone names and try to open them by reference. The only downside is that you don't known how many there will be, so you have to choose a fixed limit. Also, fixing the limit too high will take a lot more time because "Open VI Reference" is not fast at checking whether the VI exists in memory or not.
P.S.: Not sure that will change anything, but you can still kudo this idea:
Regards,
Raphaël.
You can get the number of clones:
12-11-2024 06:41 PM
Try this.
12-12-2024 04:46 AM
@paul_a_cardinale wrote:You can get the number of clones:
For me it only works when the VI is not currently running, otherwise it gives error 1000: The VI is not in a state compatible with this operation.
So I guess it can't be used for making a task manager.
12-12-2024 07:05 AM
@Kyle97330 wrote:
Can you explain why you are trying to do this?
It may be that there's an alternate way to do what you want, but by focusing only on the "App.AllVIs" property and not your general task, we can't suggest anything else.
Partially to see if it can be done. Partially, to get better visibility on what's going on. My application is making LOTs of clones. I could see a situation where I'm making many more than I need to.. let's call it a clone leak.. and having an additional troubleshooting tool would be nice.
12-12-2024 07:14 AM - edited 12-12-2024 08:08 AM
@paul_a_cardinale wrote:
Try this.
This looks much closer to what I want. I can pull the list of VIs, grab their reference feed them into this VI and get the clone names. I know each VI can't have more clones than the total number of clones in the system. With that said, I probably won't use it. When I read the context help for Generate Clone Name.vi it basically says it'll cause system instability.
I think the "Get Number of Clones" will get me 90% of where I want to be w/o the risk. In my mind, from the responses, I think the answer is it's possible.... but may not be a good idea. I do agree that this would be a handy feature to have in LV (without all the caution statements).
For anyone else going down this rabit hole, I modified my code:
However, when I sort by "Number of Clones" the "winner" is only six clones. I know for a fact, that I have 50+ clones for a particular VI running in the background. So that VI must not be in memory to get polled. So, I suppose, I could search the project for all my packed libraries (all the clones originate from packed libraries), make a list of all the VIs in them, and then create additional references to each VI and get the info.. But this seems like a pretty bad idea for me. The code already takes forever to execute.
12-12-2024 11:38 AM
@joshua.l.guthrie2.civ wrote:
I'm looking to get a list of all the VIs in memory.
Yes, so does everyone.
Officially, references to clones are not supported at all.
I don't know any except to brute forcing the VI names...
There used to be a more efficient way to calculate those clone names. Most of that calculation used to be the same for each clone, so recalculating it used to take a lot more time. IIRC, calculating one and simply adding 1 to the result used to work. Maybe it still does.
Metrics.NumberOfClones doesn't work well... It only returns the number of clones if none of the clones are running, or just the original, or who knows. Sometimes it works often it doesn't. I can imagine it's related to the time the metrics are calculated, but who knows.
12-12-2024 11:41 AM
wiebe@CARYA wrote:I don't know any except to brute forcing the VI names...
Maybe there is a way using the CookieJar, but I know very little about that.