Home

Awesome

Beamchmark

Hex.pm API Docs CircleCI

Tool for measuring EVM performance.

At the moment, the main interest of Beamchmark is scheduler utilization, reductions and the number of context switches. For more information please refer to API docs. Currently, Beamchmark is supported on macOS, Linux and partially on Windows.

Beamchmark and Benchee

Beamchmark should be used when you want to measure BEAM performance while it is running your application. Benchee should be used when you want to benchmark specific function from your code base. In particular, Benchee will inform you how long your function is executing, while Beamchmark will inform you how busy BEAM is.

Installation

The package can be installed by adding beamchmark to your list of dependencies in mix.exs:

def deps do
  [
    {:beamchmark, "~> 1.4.1"}
  ]
end

Usage

Running an application using Beamchmark.Scenario

You create a test scenario by adopting Beamchmark.Scenario behaviour in a module. It has to implement run() function, which will execute for benchmarking.

The examples of using Scenario are located in the examples directory. To run one of them, simply use the following command:

mix run examples/<example_name>.exs

Running Beamchmark in an attached mode

If you want to measure the performance of an already running BEAM you can run Beamchmark in an attached mode. However, it is required that the node on which your application is running is a distributed node and has Beamchmark added to its dependencies.

To run an example of Beamchmark in attached mode first start the node, which performance will be measured:

cd examples/attached
mix deps.get
elixir --sname counter@localhost -S mix run start_counter.exs

The node will be visible under counter@localhost name.

Now in another terminal you can start the benchmark:

epmd -daemon 
mix run examples/attached/run_attached.exs

Formatters

You can output benchmark results with Beamchmark's built-in formatters or implement a custom one. Formatters can also compare new results with the previous ones, given they share the same scenario module and were configured to run for the same amount of time.

Currently, you can output Beamchmark reports in the following ways:

Copyright and License

Copyright 2021, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0