Added smoothing of hit counts. Closing brackets were often skipped
This commit is contained in:
@@ -42,6 +42,10 @@ class Chronometer
|
||||
|
||||
[MonitoredScript[]] GetResults()
|
||||
{
|
||||
foreach($node in $this.FileMap.Values)
|
||||
{
|
||||
$node.PostProcessing()
|
||||
}
|
||||
return $this.FileMap.Values
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user