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.

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:





76 comments:

  1. 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
  2. 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
  3. Bed Bug Exterminator MarylandVery interesting topic will bookmark your site to check if you write more about in the future.

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

    ReplyDelete

  5. 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
  6. Thank you so much... your blog is giving very useful knowledge for all.
    oracle dba training in chennai

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

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

    ASP .net training in bangalore btm

    ReplyDelete


  9. 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
  10. 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
  11. Thanks for sharing informative article. Download Windows 7 ultimate for free from getintopc. It helps you to explore full functionality of windows operating system.

    ReplyDelete

  12. i am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up

    PSD to Wordpress
    wordpress website development

    ReplyDelete
  13. First of all Big thanks for sharing this with us. Excellent content with a cool idea, the great content of various kinds of the valuable information.
    selenium testing training in chennai
    Best selenium training in chennai
    selenium Classes in chennai
    FITA
    Selenium Training in Chennai
    Selenium Training in Velachery

    ReplyDelete
  14. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Online DevOps Certification Course - Gangboard

    ReplyDelete
  15. I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. 
    python interview questions and answers | python tutorialspython course institute in electronic city

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. This is ansuperior writing service point that doesn't always sink in within the context of the classroom. In the first superior writing service paragraph you either hook the reader's interest or lose it. Of course your teacher, who's getting paid to teach you how to write an good essay, 

    Java training in Chennai | Java training in USA |

    Java training in Bangalore | Java training in Indira nagar | Java training in Bangalore | Java training in Rajaji nagar

    ReplyDelete
  18. You’ve written a really great article here. Your writing style makes this material easy to understand.. I agree with some of the many points you have made. Thank you for this is real thought-provoking content
    python training in chennai
    python training in chennai
    python training in bangalore

    ReplyDelete
  19. We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done an outstanding job.
    industrial course in chennai

    ReplyDelete
  20. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
    Selenium training in Chennai

    ReplyDelete
  21. Thank you for taking time to provide us some of the useful and exclusive information with us.
    Regards,
    selenium course in chennai

    ReplyDelete
  22. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    Data Science Training in Chennai | Data Science Course in Chennai
    Python Course in Chennai | Python Training Course Institutes in Chennai
    RPA Training in Chennai | RPA Training in Chennai
    Digital Marketing Course in Chennai | Best Digital Marketing Training in Chennai

    ReplyDelete
  23. Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work.
    Thanks & Regards,
    VRIT Professionals,
    No.1 Leading Web Designing Training Institute In Chennai.

    And also those who are looking for
    Web Designing Training Institute in Chennai
    SEO Training Institute in Chennai
    Photoshop Training Institute in Chennai
    PHP & Mysql Training Institute in Chennai
    Android Training Institute in Chennai

    ReplyDelete
  24. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live.
    angularjs training in chennai | angularjs course in chennai | angularjs training institute in chennai | angularjs training institutes in chennai

    ReplyDelete
  25. onsistently learning the new skills and using them to improve myself in the form of performance for betterment.

    Thanks
    Cpa offers

    ReplyDelete
  26. This comment has been removed by the author.

    ReplyDelete
  27. Thanks for sharing such a great information..Its really nice and informative...
    devops training bangalore - eCare Technologies located in Marathahalli - Bangalore, is one of the best DevOps Training institute with 100% Placement support. DevOps Training in Bangalore provided by
    DevOps Certified Experts and real-time Working Professionals with handful years of experience in real time DevOps Projects.

    ReplyDelete
  28. I think this is one of the most significant information for me. And i’m glad reading your article. Thanks for sharing!

    Bangalore Training Academy is a Best Institute of Salesforce Admin Training in Bangalore . We Offer Quality Salesforce Admin with 100% Placement Assistance on affordable training course fees in Bangalore. We also provide advanced classroom and lab facility.

    ReplyDelete
  29. Such great information for blogger I am a professional blogger thanks…

    Advance your career as a SharePoint Admin Engineer by doing SharePoint Admin Courses from Softgen Infotech located @BTM Layout Bangalore.

    ReplyDelete
  30. Such a great word which you use in your article and article is amazing knowledge. Thank you for sharing it.

    Learn Blue Prism Course from Experts. Softgen Infotech offers the Best Blue Prism Training in Bangalore .100% Placement Assistance, Live Classroom Sessions, Only Technical Profiles, 24x7 Lab Infrastructure Support.

    ReplyDelete
  31. This comment has been removed by the author.

    ReplyDelete
  32. 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.. i Want to share Some data regarding the websphere tutorial for beginners with free bundle videos is provided.

    ReplyDelete
  33. such a great word which you use in your article and article is amazing knowledge. thank you for sharing it.

    Get SAP S4 HANA Training in Bangalore from Real Time Industry Experts with 100% Placement Assistance in MNC Companies. Book your Free Demo with Softgen Infotech.

    ReplyDelete
  34. Excellent Blog. Thank you so much for sharing...
    Best AWS with Devops Training in Bangalore | AWS with Devops Training Course Content | AWS with Devops Training Institutes | AWS with Devops Online Training - Elegant IT Services
    - Elegant IT Services provides Best AWS with Devops Training in Bangalore with expert real-time trainers who are working Professionals with min 8 + years of experience in AWS with Devops Training Industry, we also provide 100% Placement Assistance with Live Projects on AWS with Devops Training.

    ReplyDelete
  35. I think this is one of the most important info for me.And i am glad reading your article. But want to remark on few general things, The site style is good , the articles is really excellent and also check Our Profile for
    sql server training and sql server training videos

    ReplyDelete
  36. I just loved your article on the beginners guide to starting a blog. Thank you for this article. sql training online
    and sql server course with highly experienced faculty.

    ReplyDelete


  37. Wow. That is so elegant and logical and clearly explained. Brilliantly goes through what could be a complex process and makes it obvious.I want to refer about the bestwebsphere application server tutorial and websphere application server training

    ReplyDelete
  38. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    top servicenow online training
    best servicenow online training
    servicenow online training

    ReplyDelete
  39. Thanks for sharing such a great information..Its really nice and informative...
    Digital Marketing Training in Bangalore

    ReplyDelete
  40. Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written.

    data science course

    ReplyDelete
  41. I would like to comment on this quality content. I can see you have done a lot of homework and given this topic much thought.
    Best Data Science training in Mumbai

    Data Science training in Mumbai

    ReplyDelete
  42. Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks.
    Data Science Course in Bangalore

    ReplyDelete
  43. It's truly an honor to run across informational content like this. You are clearly knowledgeable on this topic and you have unique views to share.SAP training in Kolkata
    SAP training Kolkata
    Best SAP training in Kolkata
    SAP course in Kolkata
    SAP training institute Kolkata

    ReplyDelete
  44. Writing with style and getting good compliments on the article is quite hard, to be honest.But you've done it so calmly and with so cool feeling and you've nailed the job. This article is possessed with style and I am giving good compliment. Best!data science course

    ReplyDelete
  45. This article provides a valuable guide on performance profiling using Visual Studio's inbuilt tools. It's a helpful resource for developers looking to optimize their code and understand performance bottlenecks. The step-by-step instructions and insights into profiling methods make it a great reference. Thanks for sharing!
    Data Analytics Courses in Nashik

    ReplyDelete
  46. Your step-by-step guide and detailed explanations have been incredibly helpful in understanding how to optimize and troubleshoot performance issues in my projects.

    Data Analytics Courses In Chennai

    ReplyDelete
  47. Thanks for providing tutorial on "How to do Performance Profiling using Visual Studio inbuilt performance analysis tools ?
    Digital Marketing Courses in Italy

    ReplyDelete