Skip to content

Instantly share code, notes, and snippets.

@sjnovick
Created July 3, 2019 23:00
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 sjnovick/5ea454baff1380746e28a3c67cfd5a0a to your computer and use it in GitHub Desktop.
Save sjnovick/5ea454baff1380746e28a3c67cfd5a0a to your computer and use it in GitHub Desktop.
# Latency Checker v1
#
# Tests and displays latency for website(s)
#
# sjnovick 8-31-2016
#
function latcheck {
param($uri)
$i=1
$j=0
write $uri
do {
$result = Measure-Command { $request = Invoke-WebRequest -Uri $uri }
$time = $result.TotalMilliseconds
$j += $time
write "$i : $time"
$i++
}
while ($i -lt 11)
$avg = $j / $i
write "Avg: $avg"
write ""
}
latcheck -uri sjno.net
latcheck -uri www.google.com
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment