If at first you don't succeed, call it version 1.0

Contact Me

Sarvesh Kushwaha
Email : sarveshkushwaha@outlook.com

Total Pageviews

Powered by Blogger.

Google+ Followers

Monday, 11 August 2014

Performance Profiling in Visual Studio


Hi Guys after a long time i am writing this article ( Feeling very poor [GARIB] ), Jokes apart In this article i will describe how to do the performance profiling using Visual Studio.
There are many third party tools which do the Code Profiling , Memory profiling and Performance Profiling for us these are paid tools but they are good as well :
  • ANTS
  • Just Trace
  • Your KIT 
  • .NET Memory Profiler
  • Eqatec
  • Slim Tune Profiler
  • Dot Trace

As i said am feeling poor, i will describe -"How to do Performance Profiling using Visual Studio inbuilt performance analysis tools ?"


Following Versions Of the Visual Studio has this  ANALYZE tool :

  1. Visual Studio 2010 Premium and Ultimate
  2. Visual Studio 2012 Professional, Premium and Ultimate
  3. Visual Studio 2013 Professional, Premium and Ultimate
What this ANALYZE tool can do for Visual Studio supporting languages Applications ? 

1. Code Analysis : This tool can analyze code in a solution.It will tell us where we are violating the rules of code's best practices.
Open VS 2012 > Open Solution of any application > Go To Analyze Tab > Run Code Analysis



2. Performance Analysis :

Open VS 2012 > Open Solution of any application > Go To Analyze Tab > Open Performance Wizard

Step 1: Choose One Profiling Method  : (I am choosing Instrumentation because it will give us the measurement in time)





Above is the four method of profiling ,and i am going to cover the Second one which will tell us the time taken by functions :

  • CPU - Sampling : In this profiling method it scans every methods in an application and tells what percentage of CPU they are using.
  • Instrumentation : In this profiling method it tells how much time every function takes to execute.

Step 2: On page-2 of wizard Choose Modules to profile : you can profile one or more projects ,a dynamic link library ( .dll ) , an  executable file (.exe)  and  asp.net and JavaScript application.

ex: i have chosen my project i.e MVC4Bootstrap3SampleApplication




Step 3: On Page-3 of wizard :  it will ask you to choose which application you are going to profile either ASP.NET or JavaScript Application.
ex: mine is web application so opting the Enable tier interaction Profiling .

Final step : Yay click on finish button :) .

After final step you will see a VSP extension tab on your visual studio. It will keep profiling your application till you are performing the operation on browser and not stopping the profiling.After stopping the profiling you can see a report on your performance explorer.















In above image you can see my HomeController's Index method is 442.21 milliseconds Avg.Elapsed Exclusive Time and 453.78 milliseconds Avg. Elapsed Inclusive Time.

  • Inclusive Time : Inclusive time tells us the function takes time along with other calls from function.
  • Exclusive Time: Exclusive time tells us how much time taken by that particular function excluding functions called from that particular function.

My Application HomeController's Index method taken 442.21 milliseconds.Click on the function :
























Note: By default Instrumentation method of profiling will include all the methods which is invoked from the launch of an application.It will include the small and system functions and system dll functions you are using in your application.

Tricks :

How to Exclude Short functions from Instrumentation :
So the result of functions coming into report will be reduced.

  • In Performance Explorer, select Performance Session and then right-click on that and select Properties.
  • The Property Pages dialog box is displayed.
  • In the Property Pages, click the Instrumentation properties.
  • To exclude short functions from instrumentation, uncheck Exclude short functions from Instrumentation.














How to Limit Instrumentation to Specific Functions :

  • In Performance Explorer, select Performance Session and then right-click on that and select Properties.
  • Go to the Advanced section, under "Additional instrumentation options", specify the methods you specifically want to profile (e.g. "/include:MyNamespace.MyClass::MyFunc")
  • To select all the methods of a namespace : ( For example, "/include:MyNS::*" specifies all functions in the MyNS namespace).




thats all folks for instrumentation :) .

References and further readings:





Reactions:

56 comments:

  1. Thanks for your informative article and the blog. Your article is very useful for .net professionals and freshers looking for interview. Best DOT NET Training | Dot Net course Chennai

    ReplyDelete
  2. This is exactly what I was searching for. Awesome post. Thanks a bunch. Helped me in taking class for my students. Wish to follow your posts, keep writing! God Bless!
    Raksha
    Dot Net course in Chennai | Dot Net course in Chennai | Dot Net course in Chennai

    ReplyDelete
  3. There are lots of information about latest technology and how to get trained in them, like Best Hadoop Training In Chennai in Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies Hadoop Training in Chennai By the way you are running a great blog. Thanks for sharing this blogs..

    ReplyDelete
  4. I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    SalesForce Training in Chennai

    ReplyDelete
  5. Pretty article! I found some useful information in your blog, it was awesome to read,thanks for sharing this great content to my vision, keep sharing..
    Unix Training In Chennai

    ReplyDelete
  6. This information is impressive..I am inspired with your post writing style & how continuously you describe this topic. After reading your post,thanks
    for taking the time to discuss this, I feel happy about it and I love learning more about this topic..
    Android Training In Chennai In Chennai

    ReplyDelete
  7. SAP Training in Chennai
    This post is really nice and informative. The explanation given is really comprehensive and informative..

    ReplyDelete
  8. Oracle Training in chennai
    Thanks for sharing such a great information..Its really nice and informative..

    ReplyDelete
  9. Selenium Training in Chennai
    Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..

    ReplyDelete
  10. Data warehousing Training in Chennai
    I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly..

    ReplyDelete
  11. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly,but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing..
    Websphere Training in Chennai

    ReplyDelete
  12. Oracle DBA Training in Chennai
    Thanks for sharing this informative blog. I did Oracle DBA Certification in Greens Technology at Adyar. This is really useful for me to make a bright career..

    ReplyDelete
  13. This is really an awesome article. Thank you for sharing this.It is worth reading for everyone. Visit us:
    Oracle Training in Chennai

    ReplyDelete
  14. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
    Oracle DBA Training in Chennai

    ReplyDelete
  15. great article!!!!!This is very importent information for us.I like all content and information.I have read it.You know more about this please visit again.
    Oracle RAC Training in Chennai

    ReplyDelete
  16. Wonderful tips, very helpful well explained. Your post is definitely incredible. I will refer this to my friend.
    SalesForce Training in Chennai

    ReplyDelete
  17. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
    Java Training in Chennai

    ReplyDelete
  18. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    PHP Training in Chennai

    ReplyDelete
  19. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for me..
    Android Training in Chennai

    ReplyDelete
  20. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    SAP Training in Chennai

    ReplyDelete
  21. Excellent information with unique content and it is very useful to know about the information based on blogs.
    Hadoop Training in Chennai

    ReplyDelete
  22. Excellent information with unique content and it is very useful to know about the information based on blogs.
    Hadoop Training In Chennai | oracle apps financials Training In Chennai | advanced plsql Training In Chennai

    ReplyDelete
  23. That is a brilliant article on dot net training in Chennai that I was searching for. Helps us a lot in referring at our dot net training institute in Chennai. Thanks a lot. Keep writing more on dot net course in Chennai, would love to follow your posts and refer to others in dot net training institutes in Chennai.

    ReplyDelete
  24. Bed Bug Exterminator MarylandVery interesting topic will bookmark your site to check if you write more about in the future.

    ReplyDelete
  25. Florida Personal Injury Attorney I would like to thank you for your nicely written post, its informative and your writing style encouraged me to read it till end. Thanks

    ReplyDelete
  26. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    Oracle Training In Chennai

    ReplyDelete
  27. Best SQL Query Tuning Training Center In ChennaiIt’s too informative blog and I am getting conglomerations of info’s about Oracle interview questions and answer .Thanks for sharing, I would like to see your updates regularly so keep blogging.

    ReplyDelete
  28. Bed Bug Control Leesburg VA I am really impressed with your efforts and really pleased to visit this post.

    ReplyDelete

  29. Wow! That's really great information guys.I know lot of new things here. Really great contribution.Thank you ...

    Testing Training with Live Project

    ReplyDelete
  30. Bed Bug Exterminator Maryland Nice Post! I am really impressed with your efforts and really pleased to visit this post.

    ReplyDelete
  31. Rolex Watches Authentic Mens & Ladies Rolex Datejust, President Watches for Sale at JavyEstrella.com.

    ReplyDelete
  32. This is my first visit to your blog, your post made productive reading, thank you. dot net training in chennai

    ReplyDelete
  33. Thank you so much... your blog is giving very useful knowledge for all.
    oracle dba training in chennai

    ReplyDelete
  34. Wow! That's really great information guys.I know lot of new things here. Really great contribution.Thank you ...
    SharePoint training in chennai

    ReplyDelete
  35. Enroll for Java Training in Bangalore with DataBytes; best Java Coaching Institutes in Bangalore.

    ReplyDelete
  36. You post explain everything in detail and it was very interesting to read. Thank you. nata coaching centres in chennai

    ReplyDelete
  37. found very interesting to read and it was much informative.

    ASP .net training in bangalore btm

    ReplyDelete
  38. Informative article, just what I was looking for.seo services chennai

    ReplyDelete


  39. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  40. Pretty section of content. I simply stumbled upon your site and in accession capital to say that I get actually loved to account your blog posts.
    SQL Server Training in Chennai

    ReplyDelete
  41. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    Android App Development Company

    ReplyDelete
  42. Some party use aluminium scaffolding for dinning table. Such as 300 member food taken in 60 Set of aluminium scaffolding table model.

    ReplyDelete
  43. This article is very much helpful and i hope this will be an useful information for the needed one.Keep on updating these kinds of informative things...
    iOS App Development Company
    iOS App Development Company

    ReplyDelete
  44. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    <Fitness SMS
    Fitness Text
    Salon SMS
    Salon Text
    Investor Relation SMS
    Investor Relation Text
    Mobile Marketing Services
    mobile marketing companies
    Sms API

    ReplyDelete
  45. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  46. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India

    ReplyDelete
  47. Hi Its a wonderful blog. I tried doing the instrumentation based profiling. But it doesnt work and throws an error prf0002: instrumentation failed with these options: /u. I have no clue what is happening. Please let me know if you have encountered similar problem?

    ReplyDelete