package multicore-bench

  1. Overview
  2. Docs

Recording timings of benchmarks running on multiple domains in parallel and producing metrics from the recorded timings.

type t

Represents a record of elapsed times of multiple runs of a benchmark running on multiple domains.

val record : budgetf:float -> n_domains:int -> ?ensure_multi_domain:bool -> ?domain_local_await:[< `Busy_wait | `Neglect Busy_wait ] -> ?n_warmups:int -> ?n_runs_min:int -> ?n_runs_max:int -> ?before:(unit -> unit) -> init:(int -> 's) -> ?wrap:(int -> 's -> (unit -> unit) -> unit) -> work:(int -> 's -> unit) -> ?after:(unit -> unit) -> unit -> t

record ~budgetf ~n_domains ~init ~work () essentially repeatedly runs let x = init i in wrap i x (fun () -> .. work i x ..) on specified number of domains, i ∊ [0, n_domains-1], and records the times that calls of work take. The calls of work are synchronized to start as simultaneously as possible.

Optional arguments:

  • ~ensure_multi_domain: Whether to run an extra busy untimed domain when n_domains is 1. Doing so prevents the OCaml runtime from using specialized runtime implementations. Defaults to true.
  • ~domain_local_await: Specifies whether and how to configure domain-local-await or DLA. `Neglect does not reconfigure DLA. `Busy_wait configures DLA to use a busy-wait implementation, which prevents domains from going to sleep. Defaults to `Busy_wait.
  • ~n_warmups: Specifies the number of warmup runs to perform before the actual measurements. Defaults to 3.
  • ~n_runs_min: Specifies the minimum number of timed runs. The upper bound is determined dynamically based on budgetf. Defaults to 7.
  • ~n_runs_max: Specifies the maximum number of timed runs. Defaults to 1023.
  • ~before: Specifies an action to run on one domain before init.
  • ~after: Specifies an action to run on one domain after work.
val to_thruput_metrics : n:int -> singular:string -> ?plural:string -> config:string -> ?unit_of_time:Unit_of_time.t -> ?unit_of_rate:Unit_of_rate.t -> t -> Metric.t list

to_thruput_metrics ~n ~singular ~config times produces a pair of metrics from the recorded times where one metric is for the time a single operation takes and the other is the thruput of operations over all domains.

Optional arguments:

  • ~plural: Plural for the operation. Defaults to singular ^ "s".
  • ~unit_of_time: Unit of time for the duration of a single operation. Defaults to `ns.
  • ~unit_of_rate: Unit of rate for the number of operations per second. Defaults to `M.
OCaml

Innovation. Community. Security.