While cleaning the code up behind the dependency viewer I was able to improve its performance by about a factor of 100. I will tell you how I did that and also give you some detail on how this thing works in this post. You can download the Class Dependency Viewer as a VIP at the bottom of this page. So how did I get 100x gains in efficiency? Sadly, it had nothing to do with my abilities as a programmer. It turns out that there is no way to get a list of a dependencies for a class using public VI Server calls. Since the whole point of the tool is to visualize how classes depend upon one another I had to brute force a solution. I was using VI Server to open a *.lvproj in the background and adding one class to it at a time, using the project API to scrape the dependencies from the class, removing that class from the project and repeating. Yikes, right? I was complaining about this to fellow LabVIEW Champion Chris Relf and he recommended pinging NI to see if they could help. NI was great and got back to me right away with a solution, an internal method capable of taking in a path to a LabVIEW file and returning all of its dependencies. Thanks NI! So with access to the internal method I refactored the code behind the Dependency Viewer and built a Tools menu plugin for it and a VI package to distribute it. Here is a demo of the new version: As you saw in the demo the code is pretty simple, we are using the internal method that NI gave us to find dependencies of each class in a project, and then we build up a dependency matrix. Once we have the dependency matrix in hand we can do anything we want with the data. As I mentioned I built the tool into a VI Package and have attached it to this page (LabVIEW 2014 and higher as I don't have access to anything older at the moment). Once you have installed the VIP you can find the code at "C:\Program Files (x86)\National Instruments\LabVIEW 2014\project\_Class Dependency Viewer". All of the HTML, JavaScript and CSS are in the "_public" directory, and the rest is vanilla LabVIEW. If you do end up making any updates or finding any bugs please let me know. Also, if you have any question you can ask them in the comments section below and I will get back to you as quickly as I can. Jon McBee is a Principal Software Engineer at Cambridge NanoTech and is a Certified LabVIEW Architect, Certified LabVIEW Embedded Developer, Certified TestStand Developer, an NI Certified Professional Instructor, and a LabVIEW Champion VIP download moved to the tools page.
18 Comments
Mike King
1/29/2016 01:12:57 am
Great tool Jon and nice improvements now. Thanks for building it and sharing it out, hope to make use of it as well.
Reply
2/1/2016 04:42:41 pm
Very nice tool, what do you think it would take to have a similar tool for lvlib instead of lvclass? This would be extremely handy for my team!
Reply
Jon McBee
2/1/2016 06:44:38 pm
Hi Emmanuel,
Reply
Emmanuel Beraud
2/2/2016 08:48:51 pm
I started taking a look but hit a wall at the password-protected Read Linker Info (Wrapper).vi.
Reply
Jon McBee
2/3/2016 10:00:14 am
Hi Emmanuel,
Reply
Emmanuel Beraud
2/3/2016 12:27:06 pm
Thanks, this is great. May I make 2 suggestions:
Reply
Jon McBee
2/3/2016 03:27:48 pm
Hi Emmanuel,
Reply
Emmanuel Beraud
2/3/2016 04:22:27 pm
Thanks for being so fast. This is my feedback:
Emmanuel Beraud
2/3/2016 04:26:58 pm
Sorry the browser removed all the spaces I had put to align the nesting. I'll use | when for alignment.
Emmanuel Beraud
2/3/2016 04:29:13 pm
WT*! Last try:
Jon McBee
2/4/2016 08:28:55 am
Hi Emmanuel,
Reply
Emmanuel Beraud
2/4/2016 04:42:17 pm
It is working great. Thanks Jon!
Jon McBee
2/3/2016 12:49:46 pm
Hi Emmanuel,
Reply
Paul Ross
2/4/2016 10:40:33 am
Hi Jon,
Reply
T.L.
2/17/2016 07:37:15 am
Hi,
Reply
Jon McBee
2/17/2016 08:49:36 am
Hi TL,
Reply
Eric Beutlich
6/2/2017 06:04:29 pm
I love this tool!
Reply
Jon McBee
6/9/2017 10:20:18 am
Hi Eric,
Reply
Leave a Reply. |
Tags
All
Archives
October 2019
LabVIEW Blogs |