Created
September 17, 2025 13:04
-
-
Save BeniFreitag/29e2e394e89a5541837cc8e1549e0564 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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