Benchee v0.99.0 Benchee.Conversion View Source
Integration of the conversion of multiple units with benchee.
Can be used by plugins to use benchee unit scaling logic.
Link to this section Summary
Functions
Takes scenarios and a given scaling_strategy, returns the best units for the given scaling strategy. The return value changes based on whether you want units for run time or memory usage
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 units for the given scaling strategy. The return value changes based on whether you want units for run time or memory usage.
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: 1_000_000.0, ips: 1000.0}
iex> scenario = %Benchee.Scenario{
...> run_time_data: %Benchee.CollectionData{statistics: statistics},
...> memory_usage_data: %Benchee.CollectionData{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: 1_000_000,
name: :millisecond
},
memory: %Benchee.Conversion.Unit{
label: "KB",
long: "Kilobytes",
magnitude: 1024,
name: :kilobyte
}
}