Skip to content

Instantly share code, notes, and snippets.

@BeniFreitag
Created September 17, 2025 13:04
Show Gist options
  • Save BeniFreitag/29e2e394e89a5541837cc8e1549e0564 to your computer and use it in GitHub Desktop.
Save BeniFreitag/29e2e394e89a5541837cc8e1549e0564 to your computer and use it in GitHub Desktop.
[CmdletBinding()]
param (
[string]$Url = "http://my-url.com",
[int]$Interval = 1
)
$csvPath = "$PSScriptRoot\Performance $(Get-Date -Format 'yyyy-MM-dd HH-mm-ss').csv"
while ($true) {
$start = Get-Date
$duration = Measure-Command {
$response = Invoke-WebRequest $Url
}
$log = ([PSCustomObject]@{
Start = $start
Duration = [Math]::Round($duration.TotalMilliseconds)
RawContentLength = $response.RawContentLength
})
Write-Output $log
$log | Export-Csv -Path $csvPath -Append -NoTypeInformation -Delimiter ";" -Encoding utf8BOM
Start-Sleep -Seconds $Interval
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment