Benchee v0.11.0 Benchee.Conversion View Source

Integration of the conversion of multiple units with benchee.

Can be used by plugins to use benche unit scaling logic.

Link to this section Summary

Functions

Takes scenarios and a given scaling_strategy, returns the best unit for run_time and ips, according to the scaling_strategy, in a map

Link to this section Functions

Link to this function units(scenarios, scaling_strategy) View Source

Takes scenarios and a given scaling_strategy, returns the best unit for run_time and ips, according to the scaling_strategy, in a map.

The units can then be passed on to the appropriate format calls to format the output of arbitrary values with the right unit.

Examples

iex> statistics = %Benchee.Statistics{average: 1000.0, ips: 1000.0}
iex> scenario = %Benchee.Benchmark.Scenario{run_time_statistics: statistics}
iex> Benchee.Conversion.units([scenario], :best)
%{
  ips:      %Benchee.Conversion.Unit{
              label: "K",
              long: "Thousand",
              magnitude: 1000,
              name: :thousand
            },
  run_time: %Benchee.Conversion.Unit{
              label: "ms",
              long: "Milliseconds",
              magnitude: 1000,
              name: :millisecond
            }
}