Use the built-in profiler VS2010. It will show you the code paths that have the highest cost.
More details:
Click "Analysis" → "Run Performance Wizard" ... in the VS2010 main menu. (I have VS Ultimate, I'm not sure if this is available in all versions.
Select Toolbox. Click "Next. (Experiment with all parameters !: D)
Select the project you want to analyze. Click "Next."
Select Enable Inter-Level Interaction, if necessary. Click Next, then click Finish.
VS now launches IE and launches your application. Follow the steps in your application that you want to verify. Close IE.
A profiling report will be displayed, in which profiling sessions will be described in detail. Pay particular attention to the Hot Way.
Have fun debugging!
source share