View Source erlperf (erlperf v2.1.0)

Application API. Benchmark/squeeze implementation.

Link to this section Summary

Functions

Generic execution engine. Supply multiple code versions, run options and either undefined for usual benchmarking, or squeeze mode settings for concurrency test.
Comparison run: starts several jobs and measures throughput for all of them at the same time. All job options are honoured, and if there is isolation applied, every job runs its own node.
Records call trace, so it could be used to benchmark later.
Simple case. Runs a single benchmark, and returns a steady QPS number. Job specification may include suite & worker init parts, suite cleanup, worker code, job name and identifier (id).
Single throughput measurement cycle. Additional options are applied.
Concurrency measurement run.
Starts a new continuously running job with the specified concurrency. Requires erlperf application to be started.
Timed benchmarking, runs the code Count times and returns time in microseconds it took to execute the code.

Link to this section Types

-type concurrency_result() :: {QPS :: non_neg_integer(), Concurrency :: non_neg_integer()}.
-type concurrency_test() :: #{threshold => pos_integer(), min => pos_integer(), max => pos_integer()}.
Link to this type

concurrency_test_result/0

View Source
-type concurrency_test_result() ::
    concurrency_result() | {Max :: concurrency_result(), [concurrency_result()]}.
-type isolation() :: #{host => string()}.
-type run_options() ::
    #{concurrency => pos_integer(),
      sample_duration => pos_integer() | undefined,
      warmup => non_neg_integer(),
      samples => pos_integer(),
      cv => float(),
      priority => erlang:priority_level(),
      report => extended,
      isolation => isolation()}.
-type run_result() :: Throughput :: non_neg_integer() | [non_neg_integer()].

Link to this section Functions

Link to this function

benchmark(Codes, Options, ConOpts)

View Source
Generic execution engine. Supply multiple code versions, run options and either undefined for usual benchmarking, or squeeze mode settings for concurrency test.
Link to this function

compare(Codes, RunOptions)

View Source
-spec compare([code()], run_options()) -> [run_result()].
Comparison run: starts several jobs and measures throughput for all of them at the same time. All job options are honoured, and if there is isolation applied, every job runs its own node.
Link to this function

record(Module, Function, Arity, TimeMs)

View Source
-spec record(module(), atom(), non_neg_integer(), pos_integer()) -> [[{module(), atom(), [term()]}]].
Records call trace, so it could be used to benchmark later.
-spec run(code()) -> non_neg_integer().
Simple case. Runs a single benchmark, and returns a steady QPS number. Job specification may include suite & worker init parts, suite cleanup, worker code, job name and identifier (id).
-spec run(code(), run_options()) -> run_result().
Single throughput measurement cycle. Additional options are applied.
Link to this function

run(Module, Function, Args)

View Source
-spec run(module(), atom(), [term()]) -> run_result();
   (code(), run_options(), concurrency_test()) -> concurrency_test_result().
Concurrency measurement run.
Link to this function

start(Code, Concurrency)

View Source
-spec start(code(), Concurrency :: non_neg_integer()) -> pid().
Starts a new continuously running job with the specified concurrency. Requires erlperf application to be started.
-spec time(code(), Count :: non_neg_integer()) -> TimeUs :: non_neg_integer().
Timed benchmarking, runs the code Count times and returns time in microseconds it took to execute the code.