SharePoint Developer DashBoard is a new added component to SharePoint 2010 to enable SharePoint Developers and Farm Administrators easy access to Diagnostic information. It is 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. 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 the issues. But after Developer Dashboard introduction, a developer can identify this type of problem by looking at page output. Now we can enable this functionality using Sharepoint object model.
Code to enable Sharepoint Developer Dashboard:
SPDeveloperDashboardSettings objSPDeveloperDashboardSettings = SPWebService.ContentService.DeveloperDashboardSettings;
objSPDeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.On;
objSPDeveloperDashboardSettings.TraceEnabled = true;
Add two namespaces to run this code: