Did you know: using Developer Dashboard for monitoring performance of your solutions
Best Practices, Development, SharePoint 2010, Tips & TricksSharePoint 2010 ships with Developer Dashboard which allows you to see how well different pieces of SharePoint are performing. And while it’s extremely useful by itself, it becomes even more important when used to measure the performance of your custom code!
Logging the performance of your custom code to Developer Dashboard is really easy. All you have to do is to wrap a block of your code in a using clause and that’s it:
protected override void CreateChildControls()
{
using (new SPMonitoredScope("My code block (WebPart1)"))
{
Thread.Sleep(50);
}
}
Will log the following message to the Developer Dashboard:
That’s not all. You can also nest messages to provide some more granular information about your code. All you have to do is to nest the using statements and the Developer Dashboard will do the rest for you:
protected override void CreateChildControls()
{
using (new SPMonitoredScope("My code block (WebPart1)"))
{
using (new SPMonitoredScope("My first block (WebPart1)"))
{
Thread.Sleep(10);
}
using (new SPMonitoredScope("My second block (WebPart1)"))
{
Thread.Sleep(20);
}
using (new SPMonitoredScope("My third block (WebPart1)"))
{
Thread.Sleep(30);
}
}
}
Notice the nested overview in the Developer Dashboard:
One thing to remember about the Developer Dashboard is that you cannot log the performance of your code from Sandbox Solutions. The SPMonitoredScope class responsible for measuring the performance of your code and logging it to the Developer Dashboard doesn’t belong to the types supported in the Sandbox at this moment.
















June 7th, 2010 at 7:58 pm
[...] Dit blogartikel was vermeld op Twitter door Waldek Mastykarz, AndersRask. AndersRask heeft gezegd: RT @waldekm: New post: 'Did U know: using Developer Dashboard 4 monitoring perf of yr solutions' http://tinyurl.com/23jygvs #SharePoint [...]
June 7th, 2010 at 8:22 pm
Good coverage of the custom messages to the dashboard. Was just about to write something like that up myself, but now I don't have to. Great job
Cheers mate.