View Source Benchee.Conversion.Format behaviour (Benchee v1.1.0)
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
Callbacks
Formats a number as a string, with a unit label. See Benchee.Conversion.Count
and Benchee.Conversion.Duration
for examples
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
Link to this section Callbacks
Specs
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
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"
Formats a unit value with specified label and separator