?
Solved

Program counting classes and methods in C# files

Posted on 2008-10-08
4
Medium Priority
?
233 Views
Last Modified: 2013-12-17
Hello,

do you know about some program that takes as the input some Solution in .Net (many C# files in projects), and the output is some chart of most frequently used classes (were instantiated many times) and methods (were callsed many times).

e.g.

ranking | method name | number of calls
1             method1()         2045
2             hello()                191
3             yes()                   3

thanks
0
Comment
Question by:xRalf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 960 total points
ID: 22670990
dont really know of any such tool but what you can do is get the information for one assembly
you can use reflection to load the assemnbly at run time and then can find all the types in the assembly their methods etc
http://www.dotnetspider.com/resources/19318-Reflection-C.aspx
http://articles.directorym.net/_NET_Tip_Display_Public_Information_for_an_Assembly-a923981.html
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 1040 total points
ID: 22671046
I don't think reflection will help too much here as what he seems to be asking for is how often the calls were made at runtime... unless I am mistaken (there is no way to find out how many times an object will be instantiated at runtime by analyzing source code, just how many times it will be instantiated).


For this I would recommend (costs money) ants profiler http://www.red-gate.com/Products/ants_profiler/index.htm
or free CLR Profiler http://msdn.microsoft.com/en-us/netframework/aa569269.aspx

Both use the profiler API to access this information.


If you are just looking for source analysis there is a great product out there called ndepend http://www.ndepend.com/ that will do all that you are asking and a *whole* lot more.

Cheers,

Greg Young
0
 
LVL 6

Author Comment

by:xRalf
ID: 22672826
Thanks both a lot, I haven't thought about profiling at runtime but I'm blad that you expanded my question...
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 22672873
also ragi... to look for instantiations/method calls etc you would actually have to start parsing IL not just use reflections ... this is not actually too tough to do if you are familiar with IL but is non-trivial for most.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question