measure startup time under debugger in Visual studio
This commit is contained in:
Родитель
bfb2135b5e
Коммит
619ef80cfc
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.22808.1
|
||||
VisualStudioVersion = 14.0.22823.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2E6DDE9E-8C75-4F9C-8906-08EBDD6E73EF}"
|
||||
EndProject
|
||||
|
@ -24,6 +24,11 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "FunctionalTestUtils", "test
|
|||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApiShimFw46.FunctionalTests", "test\WebApiShimFw46.FunctionalTests\WebApiShimFw46.FunctionalTests.xproj", "{11FB2EE6-7199-4AFF-BC73-25F35675F233}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StartupPerf", "StartupPerf", "{16B44D67-6214-4DDE-B419-93EF073E2E69}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
test\StartupPerf\startupPerf.ps1 = test\StartupPerf\startupPerf.ps1
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -60,5 +65,6 @@ Global
|
|||
{330152EC-1092-41F0-9F96-C3438E07FCC2} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
|
||||
{B7217A00-66FA-49A8-8EF3-39C07E1F7E33} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
|
||||
{11FB2EE6-7199-4AFF-BC73-25F35675F233} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
|
||||
{16B44D67-6214-4DDE-B419-93EF073E2E69} = {8B5230E5-8138-44D6-839F-DF9248F195EE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# execute this first: Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Confirm
|
||||
|
||||
function GetUrlStatusCode($url)
|
||||
{
|
||||
$req = [system.Net.WebRequest]::Create($url)
|
||||
try {
|
||||
$res = $req.GetResponse()
|
||||
} catch [System.Net.WebException] {
|
||||
$res = $_.Exception.Response
|
||||
}
|
||||
return [int]$res.StatusCode
|
||||
}
|
||||
|
||||
$totalTime = 0
|
||||
$attempts = 10
|
||||
|
||||
function StartUnderDebugger()
|
||||
{
|
||||
$script:sw = [system.diagnostics.stopwatch]::StartNew()
|
||||
|
||||
$dte.ExecuteCommand("Debug.Start");
|
||||
#$dte.ExecuteCommand("Debug.StartWithoutDebugging");
|
||||
|
||||
$status = GetUrlStatusCode("http://localhost:54056/")
|
||||
while ($status -ne 200)
|
||||
{
|
||||
$status = GetUrlStatusCode("http://localhost:54056/")
|
||||
}
|
||||
|
||||
$script:sw.Stop()
|
||||
$elapsed = $script:sw.Elapsed.TotalMilliseconds
|
||||
Write-Host $elapsed
|
||||
|
||||
$global:totalTime = $global:totalTime + $elapsed
|
||||
|
||||
$dte.ExecuteCommand("Debug.StopDebugging");
|
||||
}
|
||||
|
||||
$i = 0
|
||||
while ($i -lt $attempts)
|
||||
{
|
||||
StartUnderDebugger
|
||||
$i = $i + 1
|
||||
}
|
||||
|
||||
Write-Host "Total $attempts attempts"
|
||||
|
Загрузка…
Ссылка в новой задаче