@@ -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 }
@@ -243,6 +255,14 @@ defmodule Benchee.Statistics do
243255 |> convert_from_statistex
244256 end
245257
258+ # It might seem silly to maintain and map statistex to our own struct,
259+ # but this gives benchee more control and makes it safer to upgrade and change.
260+ # Also, we don't expose changes in statistex versions automatically to plugins.
261+ #
262+ # As an example right now it's being discussed in statistex to add an `m2` statistic that holds
263+ # no value for benchee (as it's ony used to calculate variance).
264+ #
265+ # We also manually add `ips` related stats (see `add_ips/1`) so differences are sufficient.
246266 defp convert_from_statistex ( statistex_statistics ) do
247267 % __MODULE__ {
248268 average: statistex_statistics . average ,
@@ -253,7 +273,10 @@ defmodule Benchee.Statistics do
253273 mode: statistex_statistics . mode ,
254274 minimum: statistex_statistics . minimum ,
255275 maximum: statistex_statistics . maximum ,
256- sample_size: statistex_statistics . sample_size
276+ sample_size: statistex_statistics . sample_size ,
277+ outliers: statistex_statistics . outliers ,
278+ lower_outlier_bound: statistex_statistics . lower_outlier_bound ,
279+ upper_outlier_bound: statistex_statistics . upper_outlier_bound
257280 }
258281 end
259282
0 commit comments