diff --git a/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/addValues.st b/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/addValues.st index 9428e498..3cd7bb96 100644 --- a/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/addValues.st +++ b/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/addValues.st @@ -4,7 +4,7 @@ addValues | times average count stdev | times := values collect: [:v | v tracedValue]. count := times size. - average := times average. + average := times average roundTo: 0.01. stdev := self standardDeviation: times. self addMorphBack: ('{1} executions ({2} ms +/- {3})' format: {count . average . stdev}) asText asMorph \ No newline at end of file diff --git a/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/standardDeviation..st b/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/standardDeviation..st new file mode 100644 index 00000000..256d384f --- /dev/null +++ b/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/instance/standardDeviation..st @@ -0,0 +1,11 @@ +helpers +standardDeviation: aCollection + + | avg sample sum | + avg := aCollection average. + sample := aCollection anyOne. + sum := aCollection inject: sample into: [ :accum :each | accum + (each - avg) squared ]. + sum := sum - sample. + ^ sum = 0 + ifTrue: [0] + ifFalse: [((sum / (aCollection size - 1)) sqrt) asScaledDecimal roundTo: 0.01] \ No newline at end of file diff --git a/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/methodProperties.json b/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/methodProperties.json index bccba176..ba1aaabc 100644 --- a/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/methodProperties.json +++ b/packages/Babylonian-UI.package/BPProfilingValuesMorph.class/methodProperties.json @@ -2,4 +2,5 @@ "class" : { }, "instance" : { - "addValues" : "joabe 7/1/2023 16:21" } } + "addValues" : "pre 7/22/2024 14:01", + "standardDeviation:" : "pre 7/22/2024 14:02" } }