BenchmarkRunner
Class: BenchmarkRunner
Defined in: packages/bench/src/runner.ts:204
Run scenarios and collect their results
Constructors
Constructor
new BenchmarkRunner(
options):BenchmarkRunner
Defined in: packages/bench/src/runner.ts:225
Parameters
options
suite, backend, profile...
Returns
BenchmarkRunner
Properties
filter
protectedfilter: (name) =>boolean
Defined in: packages/bench/src/runner.ts:216
Scenario filter
Parameters
name
string
Returns
boolean
options
protectedoptions:BenchmarkRunnerOptions
Defined in: packages/bench/src/runner.ts:225
suite, backend, profile...
profile
readonlyprofile:BenchProfile
Defined in: packages/bench/src/runner.ts:212
Profile in use
reporters
protectedreporters:Reporter[]
Defined in: packages/bench/src/runner.ts:220
Reporters
results
readonlyresults:BenchResult[] =[]
Defined in: packages/bench/src/runner.ts:208
Results of the scenarios run so far
Methods
closedLoop()
closedLoop(
scenario):Promise<BenchResult|undefined>
Defined in: packages/bench/src/runner.ts:247
Run a closed-loop scenario
Parameters
scenario
the scenario
Returns
Promise<BenchResult | undefined>
the result, undefined when filtered out
custom()
custom(
scenario):Promise<BenchResult|undefined>
Defined in: packages/bench/src/runner.ts:386
Run a custom scenario
Parameters
scenario
the scenario
Returns
Promise<BenchResult | undefined>
the result, undefined when filtered out
execute()
protectedexecute(scenario,mode,measure):Promise<BenchResult|undefined>
Defined in: packages/bench/src/runner.ts:403
Run a scenario: setup, measure, verify, teardown and build its result
Parameters
scenario
the scenario
mode
"closed" | "open" | "custom"
how the load is generated
measure
(latency, errors) => Promise<CustomScenarioOutcome & object>
the measurement
Returns
Promise<BenchResult | undefined>
the result, undefined when filtered out
finish()
finish():
Promise<BenchResult[]>
Defined in: packages/bench/src/runner.ts:503
Send the results to the reporters
Returns
Promise<BenchResult[]>
the results
openLoop()
openLoop(
scenario):Promise<BenchResult|undefined>
Defined in: packages/bench/src/runner.ts:312
Run an open-loop scenario
Parameters
scenario
the scenario
Returns
Promise<BenchResult | undefined>
the result, undefined when filtered out
recordError()
protectedrecordError(errors,err):void
Defined in: packages/bench/src/runner.ts:491
Count an error and keep its message for the first ones
Parameters
errors
accumulator
err
any
the error
Returns
void
shouldRun()
shouldRun(
name):boolean
Defined in: packages/bench/src/runner.ts:237
Tell if a scenario is selected by the filter
Parameters
name
string
scenario name
Returns
boolean
true when the scenario must run
workers()
protectedworkers(count,offset,concurrency,maxDurationMs,op,latency,errors):Promise<number>
Defined in: packages/bench/src/runner.ts:279
Run operations with a pool of workers
Parameters
count
number
operations to run
offset
number
index of the first operation
concurrency
number
number of workers
maxDurationMs
number
stop starting operations after this duration
op
(index, worker) => Promise<void>
the operation
latency
LatencyRecorder | undefined
recorder, undefined to discard the latencies
errors
error accumulator
Returns
Promise<number>
the number of operations run