View Source erlperf (erlperf v2.1.0)
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 code() :: erlperf_job:code_map() | erlperf_job:callable().
-type concurrency_result() :: {QPS :: non_neg_integer(), Concurrency :: non_neg_integer()}.
-type concurrency_test() :: #{threshold => pos_integer(), min => pos_integer(), max => pos_integer()}.
-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
-spec benchmark([erlperf_job:code_map()], run_options(), undefined) -> run_result() | [run_result()]; ([erlperf_job:code_map()], run_options(), concurrency_test()) -> concurrency_test_result().
undefined
for usual benchmarking, or squeeze mode settings for concurrency test.
-spec compare([code()], run_options()) -> [run_result()].
-spec record(module(), atom(), non_neg_integer(), pos_integer()) -> [[{module(), atom(), [term()]}]].
-spec run(code()) -> non_neg_integer().
-spec run(code(), run_options()) -> run_result().
-spec run(module(), atom(), [term()]) -> run_result(); (code(), run_options(), concurrency_test()) -> concurrency_test_result().
-spec start(code(), Concurrency :: non_neg_integer()) -> pid().
erlperf
application to be started.
-spec time(code(), Count :: non_neg_integer()) -> TimeUs :: non_neg_integer().