View Source Beamchmark.Formatter behaviour (Beamchmark v1.4.1)

The module defines a behaviour that will be used to format and output Beamchmark.Suite. You can adopt this behaviour to implement custom formatters.

The module contains helper functions for validating and applying formatters defined in configuration of Beamchmark.Suite.

Link to this section Summary

Types

Options given to formatters (defined by formatters authors).

t()

Represents a module implementing Beamchmark.Formatter behaviour.

Callbacks

Takes the suite and transforms it into some internal representation, that later on will be passed to write/2.

Works like format/2, but can provide additional information by comparing the latest suite with the previous one (passed as the second argument).

Takes the return value of format/1 or format/2 and outputs it in a convenient form (stdout, file, UI...).

Functions

Takes the suite and uses its formatters to output it. If the suite was configured with compare? flag enabled, the previous suite will be also provided to the formatters.

Link to this section Types

@type options_t() :: Keyword.t()

Options given to formatters (defined by formatters authors).

@type t() :: module()

Represents a module implementing Beamchmark.Formatter behaviour.

Link to this section Callbacks

@callback format(Beamchmark.Suite.t(), options_t()) :: any()

Takes the suite and transforms it into some internal representation, that later on will be passed to write/2.

@callback format(Beamchmark.Suite.t(), Beamchmark.Suite.t(), options_t()) :: any()

Works like format/2, but can provide additional information by comparing the latest suite with the previous one (passed as the second argument).

@callback write(any(), options_t()) :: :ok

Takes the return value of format/1 or format/2 and outputs it in a convenient form (stdout, file, UI...).

Link to this section Functions

@spec output(Beamchmark.Suite.t()) :: :ok

Takes the suite and uses its formatters to output it. If the suite was configured with compare? flag enabled, the previous suite will be also provided to the formatters.