Developer dashboard is a new feature in SharePoint. It provides to developers and administrators performance and tracing information that can be used to debug and troubleshoot issues with a page rendering time. The dashboard is turned off by default but it can be enabled through C# code, stsadm or powershell command and it can have three states: On, Off, OnDemand. First two should be clear. Third one means that SharePoint will show an image button next to Your login name on a page with which You will be able to show or hide the developer dashboard.

To turn it on:

  • C#

SPWebService webService = SPWebService.ContentService;
webService.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.OnDemand;

  • Stsadm.exe

stsadm -o setproperty -pn developer-dashboard -pv [ondemand] [on] [off]

  • Powershell
$db = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$dbSettings = $db.DeveloperDashboardSettings
$dbSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::OnDemand

Image Button next to the login details:

When a dashboard is shown You can see the details about rendering time of every Web Part, executed SQL queries and general information about the page execution.

On the left side of the dashboard You can see sites’ rendering time. It’s divided for different processes which have been executed while site has been created. On the top right You have a general information about the site like overall execution time, current user or correlation id which can be very usefull along with ULS viewer tool which allows You to go view SharePoint logs. Next are executed database queries. You can see that they are really hyperlinks which when cliked will open a new window with the query details(as shown on the below screenshot).

Another information about the page execution are SPRequest Allocation entries. This is very important to developers. It shows how many SPWeb(and SPRequest along with them) objects are created. Large number(default threshold is eight) of this objects along side with not disposing them properly can cause seriuos memory leaking and performance problems.

Web Part Events Offsets show the execution time of the standard events which You override when You create a new Web Part. It’s very useful because here You can see which of the methods takes the most time to execute and where is the bottleneck.

To measure the execution time of Your custom code, for example button OnClick event, You can use C# SPMonitoredScope class. It allows You to measure the execution time of Your code and shows it on the left side of the dashboard. To use it You have  wrap Your code in a using statement like shown below:

using(SPMonitoredScope ms = new SPMonitoredScope("NameShownOnTheLeftSideOfDashboard"))


//Your code goes here