Developer dashboard is one of the coolest feature in SharePoint 2010 and loved by the developer community. Developer dashboard can help in diagnosing various issues in a custom code.

Counters in developer dashboard

Per-Thread counters

Gives the following information of current thread with actual values

Pre-Process counters

Client Counters

System Counter

How to use Monitor in Code?

Monitoring code is easy very easy with help of developer dashboard. First thing identify the portion of the code need real monitoring and wrap that code SPMonitorScope.

using (new SPMonitoredScope("TestScope"))
{
//Code which needs to be monitored goes here
}

Another approach implement ISPScopedPerformanceMonitor Interface in your custom class and use it.


Enabling Developer Dashboard

By default Developer Dash Board is disabled so you need to enable it.

STSADM Command

Dashboard1.gif

Power shell Command

Dashboard2.gif

C# Code

Dashboard3.gif

Developer Dash Board in a custom Page

<Sharepoint:DeveloperDashboardLauncher
ID="DeveloperDashboardLauncher"
NavigateUrl="javascript:ToggleDeveloperDashboard()"
runat="server"
ImageUrl="/_layouts/images/fgimg.png"
Text="<%$Resources:wss,multipages_launchdevdashalt_text%>"
OffsetX=0
OffsetY=78
Height=16
Width=16 />
<div id="DeveloperDashboard" class="ms-developerdashboard" />
<SharePoint:DeveloperDashboard runat="server" />


Read following articles about the this feature.

Using the Developer Dashboard

http://msdn.microsoft.com/en-us/library/ff512745.aspx

Using SPMonitoredScope

http://msdn.microsoft.com/en-us/library/ff512758.aspx