Friday, September 9, 2011

Developer Dashboard

Activating the Developer Dashboard

•    PowerShell
•    STSADM.exe
•    SharePoint Object Model (API's)

Activate the Developer Dashboard using PowerShell:-
$devdash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$devdash.DisplayLevel = 'OnDemand';
$devdash.TraceEnabled = $true;
$devdash.Update()

Activate the Developer Dashboard using STSADM.EXE:-
STSADM.EXE -o setproperty -pn developer-dashboard -pv ondemand

Activate the Developer Dashboard using the SharePoint Object Model:-
using Microsoft.SharePoint.Administration;
SPWebService svc = SPContext.Current.Site.WebApplication.WebService;
svc.DeveloperDashboardSettings.DisplayLevel =
    SPDeveloperDashboardLevel.Off;
svc.DeveloperDashboardSettings.Update();

•    Off (Disables the Developer Dashboard)
•    On (Enables the Developer Dashboard)
•    OnDemand (Enables the Developer Dashboard upon request by clicking the icon in the upper right corner)

SPMonitoredScope to track performance in your applications:-
 using (new SPMonitoredScope("Monitoring"))
{
    Controls.Add(new Literal { Text = "When the awesomeness is flying... " });
               
    using (new SPMonitoredScope("Sub-Monitoring"))
    {
        Controls.Add(new Literal { Text = "Hello this is --Sub-Monitoring! " });

        using (new SPMonitoredScope("Sub-Sub-Monitoring"))
        {
            Controls.Add(new Literal { Text = "<br/>Hello this is Sub-Sub-Monitoring!" });
        }

        using (new SPMonitoredScope("Sub-Sub-Monitoring_1"))
        {
            Controls.Add(new Literal { Text = "Hello this is Sub-Sub-Monitoring_1" });
        }
    }
}

Now go and test Doveloper Dashboard to find the Result with about scope names
0.Monitoring
1. Sub-Monitoring
2. Sub-Sub-Monitoring
3. Sub-Sub-Monitoring_1
  

2 comments:

Featured Post

Update SharePoint List Columns Without Touching Mandatory Fields in Power Automate

Update SharePoint List Columns Without Touching Mandatory Fields in Power Automate The Problem If you've ever tried to update a single c...

Popular posts