Improve the time measurement

This commit is contained in:
Markus Fleschutz
2021-04-15 08:41:37 +02:00
parent edb2bc56e6
commit 2b7b6fdf1a
6 changed files with 17 additions and 20 deletions

View File

@ -7,9 +7,9 @@
#>
try {
$StartTime = get-date
write-progress "Reading Data/domain-names.csv..."
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$PathToRepo = "$PSScriptRoot/.."
$Table = import-csv "$PathToRepo/Data/domain-names.csv"
@ -23,9 +23,9 @@ try {
}
$Count = $Table.Length
$Elapsed = New-Timespan -start $StartTime -end (get-date)
$Average = [math]::round($Count / $Elapsed.seconds, 1)
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($Elapsed.seconds) seconds)"
$Elapsed = $StopWatch.Elapsed
$Average = [math]::round($Count / $Elapsed.Seconds, 1)
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($Elapsed.Seconds) seconds)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"