mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-12 14:07:20 +02:00
Improve the time measurement
This commit is contained in:
@ -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])"
|
||||
|
Reference in New Issue
Block a user