Below is the object model code snippet to change the settings using object model:
SPPerformanceMonitor SPPerfMon = SPFarm.Local.PerformanceMonitor;
SPPerfMon.DeveloperDashboardLevel = SPPerformanceMonitoringLevel.On;
//SPPerfMon.DeveloperDashboardLevel = SPPerformanceMonitoringLevel.OnDemand;
//SPPerfMon.DeveloperDashboardLevel = SPPerformanceMonitoringLevel.Off;
Setting it to On shows the page diagnostics, load time and other information at the bottom of the page.
Using STSADM.exe, the scripts are:
stsadm -o setproperty -pn developer-dashboard -pv on
stsadm -o setproperty -pn developer-dashboard -pv off
stsadm -o setproperty -pn developer-dashboard -pv OnDemand
Everything that can be done in STSADM should be possible in PowerShell too. You can explore it on your own.
I am wondering if there is an option yet on the UI to manage the Developer Dashboard setting. Anyone knows?
The setting is only at the SPFarm level. It would be better if we we have an option to turn this on at the Site Collection or Site Level.
The above code does not work on the updated SP2010 vesion. Try this instead:
SPWebService cs = SPWebService.ContentService;
cs.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.OnDemand; //or On or Off
You need to refer to the Microsoft.SharePoint.Administration namespace.