Você está na página 1de 4

How to Enable the Developer Dashboard in SharePoint 2010


What is the developer dashboard you may say? Well the developer dashboard in SharePoint gives developers the ability to monitor how well their code base is performing on a page by page basis. For instance when enabled, at the bottom of every page you'll see a report of all the custom code that has ran on that page, as well as how long it took to run. This becomes very valuable information especially when querying SharePoint content. You may have several web parts on one page all querying information from across your Farm, and the SharePoint developer dashboard helps you know how well each performs, which can help you identify if one is becoming a bottle neck for your whole page. Notice this example (the report always shows at the bottom of the master page):

The report shows the following information: What controls loaded and how long each took to load What specific database queries executed and the execution time of each Events that were fired during the page load Order of the page lifecycle and time during each stage

How to Programmatically Activate the SharePoint Developer Dashboard

Via Command Prompt

Create a new console application visual studio project, and in Program.cs, add the following code:

SPPerformanceMonitor perfmon = SPFarm.Local.PerformanceMonitor; perfmon.DeveloperDashboardLevel = SPPerformanceMonitoringLevel.On; perfmon.Update();

Ensure that .NET version 3.5 is specified (SP 2010 is not yet .NET 4.0 compatible)

Also in project properties Build tab, ensure "Any CPU" is specified (defaults to x86, but SharePoint 2010 is x64 only)

Build, Execute, and Enjoy!

Via Power Shell

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} if ($snapin -eq $null) { Write-Host "Loading SharePoint Powershell Snapin" Add-PSSnapin "Microsoft.SharePoint.Powershell" } $farm = Get-SPFarm $perfmon = $farm.PerformanceMonitor $level = [Microsoft.SharePoint.Administration.SPPerformanceMonitoringLevel]::On $perfmon.DeveloperDashboardLevel = $level $perfmon.Update(); Write-Host "Sucess"