Profiling with Visual Studio Analyzer

This may or may not work with the free versions of Visual Studio. Please update this document with information on that.

Build the Visual Studio backend in order to get a Solution file:

./mach build-backend -b VisualStudio

Open $OBJDIR/msvc/mozilla.sln with Visual Studio.

From the Analyze menu, select "Launch Performance Wizard...".

Select "CPU sampling"

Select "firefox"

Click Finish

Unless you want to profile performance issues, click "Pause profiling" when Firefox starts. Once it is running, get it into the state when you're ready to profile and then click "Resume profiling". Once you've finished with the slow actions, click "Stop profiling" and wait for the analysis to be done.

Once the analysis is done, select "Functions" or "Call Tree" or whatever from the "Current View" drop-down menu at the top of the main tab.

Double clicking on a function of interest provides a pretty view along with source code highlighted hot spots allowing you to dig deeper or step higher.