Benchee v0.12.0 Benchee.Benchmark.Scenario View Source

A Scenario in Benchee is a particular case of a whole benchmarking suite. That is the combination of a particular function to benchmark (job_name and function) in combination with a specific input (input_name and input).

It then gathers all data measured for this particular combination during Benchee.Benchmark.measure/3 (run_times and memory_usages), which are then used later in the process by Benchee.Statistics to compute the relevant statistics (run_time_statistics and memory_usage_statistics).

name is the name that should be used by formatters to display scenarios as it potentially includes the tag present when loading scenarios that were saved before. See display_name/1.

Link to this section Summary

Functions

Returns the correct name to display of the given scenario data

Link to this section Types

Link to this type t() View Source
t() :: %Benchee.Benchmark.Scenario{after_each: (... -> any()) | nil, after_scenario: (... -> any()) | nil, before_each: (... -> any()) | nil, before_scenario: (... -> any()) | nil, function: (... -> any()), input: any() | nil, input_name: String.t() | nil, job_name: String.t(), memory_usage_statistics: Benchee.Statistics.t() | nil, memory_usages: [non_neg_integer()], name: String.t(), run_time_statistics: Benchee.Statistics.t() | nil, run_times: [float()], tag: String.t() | nil}

Link to this section Functions

Link to this function display_name(map) View Source
display_name(map()) :: String.t()

Returns the correct name to display of the given scenario data.

In the normal case this is job_name, however when scenarios are loaded they are tagged and these tags should be shown for disambiguation.

Examples

iex> alias Benchee.Benchmark.Scenario
iex> Scenario.display_name(%Scenario{job_name: "flat_map"})
"flat_map"
iex> Scenario.display_name(%Scenario{job_name: "flat_map", tag: "master"})
"flat_map (master)"
iex> Scenario.display_name(%{job_name: "flat_map"})
"flat_map"