Benchee v0.8.0 Benchee.Formatters.Console

Formatter to transform the statistics output into a structure suitable for output through IO.puts on the console.

Summary

Functions

Formats the benchmark statistics to a report suitable for output on the CLI

Formats the job statistics to a report suitable for output on the CLI

Formats the benchmark statistis using Benchee.Formatters.Console.format/1 and then prints it out directly to the console using IO.puts/2

Types

job_statistics()
job_statistics() :: {Benchee.Suite.key, Benchee.Statistics.t}
unit_per_statistic()
unit_per_statistic() :: %{optional(atom) => Benchee.Conversion.Unit.t}

Functions

format(suite)
format(Benchee.Suite.t) :: [any]

Formats the benchmark statistics to a report suitable for output on the CLI.

Returns a list of lists, where each list element is a group belonging to one specific input. So if there only was one (or no) input given through :inputs then there’s just one list inside.

Examples

iex> jobs = %{ "My Job" => %Benchee.Statistics{average: 200.0, ips: 5000.0,std_dev_ratio: 0.1, median: 190.0}, "Job 2" => %Benchee.Statistics{average: 400.0, ips: 2500.0, std_dev_ratio: 0.2, median: 390.0}}
iex> inputs = %{"My input" => jobs}
iex> suite = %Benchee.Suite{
...>   statistics: inputs,
...>   configuration: %Benchee.Configuration{
...>     formatter_options: %{
...>       console: %{comparison: false, unit_scaling: :best}
...>     }
...>   }
...> }
iex> Benchee.Formatters.Console.format(suite)
[["
##### With input My input #####", "
Name             ips        average  deviation         median
",
"My Job        5.00 K      200.00 μs    ±10.00%      190.00 μs
",
"Job 2         2.50 K      400.00 μs    ±20.00%      390.00 μs
"]]
format_jobs(job_stats, config)

Formats the job statistics to a report suitable for output on the CLI.

Examples

iex> jobs = %{ "My Job" =>%Benchee.Statistics{average: 200.0, ips: 5000.0,std_dev_ratio: 0.1, median: 190.0}, "Job 2" => %Benchee.Statistics{average: 400.0, ips: 2500.0, std_dev_ratio: 0.2, median: 390.0}}
iex> Benchee.Formatters.Console.format_jobs(jobs, %{comparison: false, unit_scaling: :best})
["
Name             ips        average  deviation         median
",
"My Job        5.00 K      200.00 μs    ±10.00%      190.00 μs
",
"Job 2         2.50 K      400.00 μs    ±20.00%      390.00 μs
"]
output(suite)

Formats the benchmark statistis using Benchee.Formatters.Console.format/1 and then prints it out directly to the console using IO.puts/2