Benchee v1.0.1 Benchee.Conversion.Format behaviour View Source
Functions for formatting values and their unit labels. Different domains handle this task differently, for example durations and counts.
See Benchee.Conversion.Count
and Benchee.Conversion.Duration
for examples.
Link to this section Summary
Functions
Formats a unit value in the domain described by module
. The module should
provide a units/0
function that returns a Map like
Formats a unit value with specified label and separator
Callbacks
Formats a number as a string, with a unit label. See Benchee.Conversion.Count
and Benchee.Conversion.Duration
for examples
Link to this section Functions
format(arg) View Source
Formats a unit value in the domain described by module
. The module should
provide a units/0
function that returns a Map like
%{ :unit_name => %Benchee.Conversion.Unit{ ... } }
Additionally, module
may specify a separator/0
function, which provides a
custom separator string that will appear between the value and label in the
formatted output. If no separator/0
function exists, the default separator
(a single space) will be used.
iex> Benchee.Conversion.Format.format({1.0, :kilobyte}, Benchee.Conversion.Memory)
"1 KB"
format(number, module) View Source
format(count, label, separator) View Source
Formats a unit value with specified label and separator
Link to this section Callbacks
format(number) View Source
Formats a number as a string, with a unit label. See Benchee.Conversion.Count
and Benchee.Conversion.Duration
for examples