Added static LastNode

The LastNode is used with the changes to Get-Chronometer to properly calculated data for the last line in the file. For example the following script's last line will not get any timing information because of a last record bug in the existing code:

Start-Sleep 5
Start-Sleep 10
This commit is contained in:
SteveGTR
2019-01-28 15:33:19 -05:00
committed by GitHub
parent e00e0253cd
commit 480543d41d

View File

@@ -3,6 +3,8 @@ class ScriptProfiler {
static [System.Collections.Queue] $Queue
static [System.Diagnostics.Stopwatch] $Timer
static $LastNode = $null
static [void] Start()
{
[ScriptProfiler]::Queue = New-Object System.Collections.Queue
@@ -15,5 +17,7 @@ class ScriptProfiler {
Breakpoint = $InputObject
Elapsed = [ScriptProfiler]::Timer.Elapsed
})
[ScriptProfiler]::LastNode = $InputObject
}
}