Answered by:
time page load of user controls

Question
-
I have a sharepoint site that has a user control at the top. This user control contains several other user controls. I want to determine how long it takes the main control to load. How can I do this?Tuesday, January 25, 2011 10:47 PM
Answers
-
Hi Jared,
Have you played with the Developer Dashboard built in to SharePoint 2010?
You need to enable it in code, or from PowerShell. Once enabled it places trace information at the bottom of every page.
Here's some example script for you:
$cs = [Microsoft.SharePoint.Administration.SPWebService]::ContentService $cs.DeveloperDashboardSettings.DisplayLevel = "On" $cs.DeveloperDashboardSettings.Update()
Valid values for DisplayLevel (via PowerShell) are "On", "OnDemand" and "Off". "OnDemand" puts a little icon in the top-right of your page that you can use to toggle the trace information on or off.
If you want to measure how long specific code takes to run, you could wrap the code section in a SPMonitoredScope section:
Hope this helps!using(new SPMonitoredScope("My Function")) { // run code in here and we'll time it! }
joel
Joel's SharePoint Architect Blog
joelblogs.co.uk
Want SharePoint Training?- Proposed as answer by Phill Duffy Wednesday, January 26, 2011 9:33 AM
- Marked as answer by Tobias ZimmergrenMVP Wednesday, January 26, 2011 2:55 PM
Tuesday, January 25, 2011 11:05 PM
All replies
-
Hi Jared,
Have you played with the Developer Dashboard built in to SharePoint 2010?
You need to enable it in code, or from PowerShell. Once enabled it places trace information at the bottom of every page.
Here's some example script for you:
$cs = [Microsoft.SharePoint.Administration.SPWebService]::ContentService $cs.DeveloperDashboardSettings.DisplayLevel = "On" $cs.DeveloperDashboardSettings.Update()
Valid values for DisplayLevel (via PowerShell) are "On", "OnDemand" and "Off". "OnDemand" puts a little icon in the top-right of your page that you can use to toggle the trace information on or off.
If you want to measure how long specific code takes to run, you could wrap the code section in a SPMonitoredScope section:
Hope this helps!using(new SPMonitoredScope("My Function")) { // run code in here and we'll time it! }
joel
Joel's SharePoint Architect Blog
joelblogs.co.uk
Want SharePoint Training?- Proposed as answer by Phill Duffy Wednesday, January 26, 2011 9:33 AM
- Marked as answer by Tobias ZimmergrenMVP Wednesday, January 26, 2011 2:55 PM
Tuesday, January 25, 2011 11:05 PM -
+1 Developer Dashboard
Use Jaap Vossers' visualizer as well for bonus effect
jliu - johnliu.net - sharepointgurus.netWednesday, January 26, 2011 3:04 AM -
Thanks, but I am just putting user controls on a page. Where do I wrap with the monitored scope? In the onload functions of each? Does that even contain the full page lifecycle? I am not sure if it is even done loading at the end of on load.Wednesday, January 26, 2011 2:12 PM
-
Hi,
The Dev Dashboard can give you an indication of how long things take to load. The monitored scopes are not measuring your entire user control, but rather specific functions from within. I've got a quick summary of how to deal with the Dashboard and Vossers awesome visualizer: http://bit.ly/fC0jX3
Tobias Zimmergren
Microsoft MCP, MCTS, MCT, MVP (SharePoint)
Blog: www.zimmergren.net
Twitter: twitter.com/zimmergrenWednesday, January 26, 2011 2:55 PM