@@ -25,6 +25,9 @@ defmodule Benchee.Statistics do
2525 :relative_more ,
2626 :relative_less ,
2727 :absolute_difference ,
28+ :outliers ,
29+ :lower_outlier_bound ,
30+ :upper_outlier_bound ,
2831 sample_size: 0
2932 ]
3033
@@ -85,6 +88,9 @@ defmodule Benchee.Statistics do
8588 relative_more: float | nil | :infinity ,
8689 relative_less: float | nil | :infinity ,
8790 absolute_difference: float | nil ,
91+ outliers: [ number ] ,
92+ lower_outlier_bound: number ,
93+ upper_outlier_bound: number ,
8894 sample_size: integer
8995 }
9096
@@ -115,7 +121,7 @@ defmodule Benchee.Statistics do
115121 ...> input: "Input"
116122 ...> }
117123 ...> ]
118- ...>
124+ ...>
119125 ...> suite = %Benchee.Suite{scenarios: scenarios}
120126 ...> statistics(suite, Benchee.Test.FakeProgressPrinter)
121127 %Benchee.Suite{
@@ -137,7 +143,10 @@ defmodule Benchee.Statistics do
137143 mode: [500, 400],
138144 minimum: 200,
139145 maximum: 900,
140- sample_size: 9
146+ sample_size: 9,
147+ outliers: [],
148+ lower_outlier_bound: 100.0,
149+ upper_outlier_bound: 900.0
141150 }
142151 },
143152 memory_usage_data: %Benchee.CollectionData{
@@ -153,7 +162,10 @@ defmodule Benchee.Statistics do
153162 mode: [500, 400],
154163 minimum: 200,
155164 maximum: 900,
156- sample_size: 9
165+ sample_size: 9,
166+ outliers: [],
167+ lower_outlier_bound: 100.0,
168+ upper_outlier_bound: 900.0
157169 }
158170 }
159171 }
@@ -247,6 +259,14 @@ defmodule Benchee.Statistics do
247259 |> convert_from_statistex
248260 end
249261
262+ # It might seem silly to maintain and map statistex to our own struct,
263+ # but this gives benchee more control and makes it safer to upgrade and change.
264+ # Also, we don't expose changes in statistex versions automatically to plugins.
265+ #
266+ # As an example right now it's being discussed in statistex to add an `m2` statistic that holds
267+ # no value for benchee (as it's ony used to calculate variance).
268+ #
269+ # We also manually add `ips` related stats (see `add_ips/1`) so differences are sufficient.
250270 defp convert_from_statistex ( statistex_statistics ) do
251271 % __MODULE__ {
252272 average: statistex_statistics . average ,
@@ -257,7 +277,10 @@ defmodule Benchee.Statistics do
257277 mode: statistex_statistics . mode ,
258278 minimum: statistex_statistics . minimum ,
259279 maximum: statistex_statistics . maximum ,
260- sample_size: statistex_statistics . sample_size
280+ sample_size: statistex_statistics . sample_size ,
281+ outliers: statistex_statistics . outliers ,
282+ lower_outlier_bound: statistex_statistics . lower_outlier_bound ,
283+ upper_outlier_bound: statistex_statistics . upper_outlier_bound
261284 }
262285 end
263286
0 commit comments