Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Created September 10, 2019 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellwest/caf1d2259fa40129231e1ea43ca8d340 to your computer and use it in GitHub Desktop.
Save michaellwest/caf1d2259fa40129231e1ea43ca8d340 to your computer and use it in GitHub Desktop.
Duplicates the functionality seen in the Sitecore stats.aspx admin page using Sitecore PowerShell Extensions.
$items = [Sitecore.Diagnostics.Statistics]::RenderingStatistics
$props = @{
Property = @(
@{Label="Rendering"; Expression={$_.TraceName} },
@{Label="Site"; Expression={$_.SiteName} },
@{Label="Count"; Expression={$_.RenderCount} },
@{Label="From cache"; Expression={$_.UsedCache} },
@{Label="Avg. time (ms)"; Expression={$_.AverageTime.TotalMilliseconds} },
@{Label="Avg. items"; Expression={$_.AverageItemsAccessed} },
@{Label="Max. time"; Expression={$_.MaxTime.TotalMilliseconds} },
@{Label="Max. items"; Expression={$_.MaxItemsAccessed} },
@{Label="Total time"; Expression={$_.TotalTime} },
@{Label="Total items"; Expression={$_.TotalItemsAccessed} },
@{Label="Last run"; Expression={[Sitecore.DateUtil]::ToServerTime($_.LastRendered)} }
)
}
$items | Sort-Object -Property "SiteName","TraceName" | Show-ListView @props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment