Added smoothing of hit counts. Closing brackets were often skipped

This commit is contained in:
KevinMarquette
2017-02-05 11:48:32 -08:00
parent 1d047b5f14
commit bbb7cd508d
2 changed files with 36 additions and 0 deletions

View File

@@ -42,6 +42,10 @@ class Chronometer
[MonitoredScript[]] GetResults()
{
foreach($node in $this.FileMap.Values)
{
$node.PostProcessing()
}
return $this.FileMap.Values
}
}

View File

@@ -46,4 +46,36 @@ class MonitoredScript
$this.lastRecord = $record
$this.lastNode = $node
}
[void] PostProcessing()
{
$this.lastNode = $null
$this.ExecutionTime = 0
foreach($node in $this.line)
{
$command = $node.text -replace '\s',''
switch -Regex ($command)
{
'^}$|^}#|^$' {
if($node.HitCount -eq 0)
{
$node.HitCount = $this.lastNode.HitCount
}
$node.Milliseconds = 0
$node.Average = 0
$this.lastNode = $node
}
'^{$|^{#}' {
$node.Milliseconds = 0
$node.Average = 0
$this.lastNode = $node
}
default {
$this.lastNode = $node
}
}
$this.ExecutionTime += $node.Milliseconds
}
}
}