.Net Analyze the number of times a class is used



  • I was wondering if any of you have come across a command line utility or the like that can perform a static analysis against a set of assemblies and provide a report on the number of times a class is used.  I'm looking for a utility that essentially batches Visual Studio's "Find All References" for all classes in the given set of assemblies and produces a summarized report with the ability to drill down into the details.

    I could write something, but I'd thought I'd ask before I do that.



  • @lpope187 said:

    I was wondering if any of you have come across a command line utility or the like that can perform a static analysis against a set of assemblies and provide a report on the number of times a class is used.  I'm looking for a utility that essentially batches Visual Studio's "Find All References" for all classes in the given set of assemblies and produces a summarized report with the ability to drill down into the details.

    I could write something, but I'd thought I'd ask before I do that.

     

    How about just using Reflector and then using visual studio to find all references.  Try the reflector visual studio plugin.



  • I could, but then what I'm really after to find classes that are infrequently used and then see if I can remove them.  So I'd like to have something that does all the heavy lifting to identify likely candidates for obsolesence.




  • You want to search for code coverage tools. Here's one for VS2008.  However, you should combine this with reference checks to see where it can be called from and what situations. Then you can run a code coverage tool in different test scenarios to see what was covered. If you need more performance metrics, I recommend Jetbrains DotTrace. Its not free, but it does help you iron down which portions of your program are consuming the most processing time.



  • You could also use PostSharp to instrument all your classes constructors to count up the number of times they are used and write the result out somewhere...

    http://www.postsharp.org/


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.