Using the Developer Dashboard

Applies to: SharePoint Foundation 2010

The Developer Dashboard is an instrumentation framework introduced in Microsoft SharePoint Foundation 2010. Similar in concept to ASP.NET page tracing, it provides diagnostic information that can help a developer or system administrator troubleshoot problems with page components that would otherwise be very difficult to isolate. For example, a developer can easily introduce extra SPSite or SPWeb objects into his or her code unknowingly or add extraneous SQL Server queries.

In the past, the only way to debug performance problems caused by the extra overhead of these instances in code would be to attach a debugger to the code and monitor SQL Server Profiler traces. With the Developer Dashboard, a developer can identify this type of problem, either programmatically by using the object model or visually by looking at page output.

Although performance issues and resource usage information is available in the Unified Logging Service (ULS) logs, interpreting the raw data can be very time consuming. With the Developer Dashboard, all the related information is correlated, which makes identifying these types of issues much easier.

What Information Is Captured?

Developer Dashboard contains an extensible mechanism for measuring various performance counters at various scopes. Within Developer Dashboard, the following performance counters are used to monitor usage and resource consumption at each stage of the requests.

Per-Thread Counters

These counters measure values for the current request or timer job:

  • Thread execution time

  • Number, duration, call stack information and query text of each SQL Server query generated by the page

  • Number, duration, and call stack information of each WCF call

  • URL or timer job name

  • Current user

  • Execution start time

  • Any of the preceding statistics for code enclosed by SPMonitoredScope (see Using SPMonitoredScope)

The preceding data is output to two locations at the end of every request or timer job:

  • ULS log — All collected statistics for a specified scope are always logged to the ULS log.

  • Developer Dashboard — Performance statistics for a request are available in the browser window.

Dashboard Display Modes

The Developer Dashboard can be displayed in the following modes:

  • On

    When enabled in On mode, the Dashboard is viewable on all pages that use the default master page.

  • OnDemand

    When the Developer Dashboard is set to OnDemand mode, an icon is displayed on the top right side of the page. This icon allows the user to toggle the Dashboard on and off.

    Note

    It is important to note that when the display mode is set to OnDemand, anyone who has rights to view the page will also be able to see the Dashboard output.

How to Enable the Developer Dashboard

The Developer Dashboard is always off by default. To make it viewable, you must enable it, by using STSADM, Windows PowerShell cmdlets, or the SharePoint Foundation object model.

Using STSADM

Open a command window to the %ProgramFiles%\Common Files\Microsoft Shared Debug\Web Server Extensions\14\BIN directory and enter one of the following commands, depending on the desired display mode.

Mode

Command

On

stsadm -o setproperty -pn developer-dashboard -pv on

OnDemand

stsadm -o setproperty -pn developer-dashboard -pv ondemand

Using Windows PowerShell Cmdlets

Mode

Command

On

(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = ”On”

OnDemand

(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = ”OnDemand”

How to Disable the Developer Dashboard

Using STSADM

stsadm -o setproperty -pn developer-dashboard -pv off

On Which Pages Does the Developer Dashboard Appear?

When enabled, the Developer Dashboard appears by default on any page that uses the SharePoint Foundation 2010 master page or any page using a custom master page where the Dashboard control is included.

Using Developer Dashboard on Custom Master Pages

Two components are required for the Dashboard to display. These include the Developer Dashboard Launcher and the page rendering control that renders the output to the page.

  • Developer Dashboard Launcher

    When the display mode is set to OnDemand, the Launcher displays the launcher icon. It can be used anywhere on the page. The following example shows the markup necessary to include the Launcher on a master page.

    <Sharepoint:DeveloperDashboardLauncher
       ID="DeveloperDashboardLauncher"
       href="javascript:ToggleDeveloperDashboard()"
       runat="server"
       ImageUrl="/_layouts/images/fgimg.png"
       Text="<%$Resources:wss,multipages_launchdevdashalt_text%>"
       OffsetX=0
       OffsetY=222
       Height=16
       Width=16 />
    
  • Page Rendering Control.

    The rendering control must located be at the bottom of the page markup. Any controls on the page that fall below the rendering control will not have their metrics reported to the Developer Dashboard.

    <SharePoint:DeveloperDashboard runat="server" />
    

Using Developer Dashboard with Custom Code

With the introduction of the SPMonitoredScope class, a developer has the ability to ”wrap” code and have the usage statistics for that code displayed on the screen. This information can be used to identify potential points of failure or, at the very least, components that are not performing as expected.

See Also

Concepts

Using SPMonitoredScope

Avoiding Unnecessary Construction of SPWeb and SPSite Objects