package multicore-bench

  1. Overview
  2. Docs

Utilities for creating benchmarks.

⚠️ In the future we expect to regroup these utilities under different modules and deprecate them in this module.

val iter_factor : int

A multiplier depending various factors such as whether we are running on a 32- or 64-bit machine (1x/10x), bytecode or native (1x/10x), and whether we are running on single-core or multicore OCaml (1x/10x).

val alloc : ?batch:int -> int Atomic.t -> int

alloc ~batch n tries to decrement the specified atomic variable n by at most the optional amount ~batch and not beyond n having value 0. Returns the amount by which n was decremented, which is 0 only in case n is 0.

val cross : 'a list -> 'b list -> ('a * 'b) list

cross xs ys returns a list formed by pairing each element of xs with each element of ys.

For example:

# Util.cross [1; 2; 3] ["a"; "b"]
- : (int * string) list =
[(1, "a"); (1, "b"); (2, "a"); (2, "b"); (3, "a"); (3, "b")]
module Bits : sig ... end

A minimalistic bitset data structure.

val generate_push_and_pop_sequence : ?state:Random.State.t -> int -> Bits.t

generate_push_and_pop_sequence n generates a bitset where each true bit represents a "push" operation and each false bit represents a "try_pop" operation. Performing the operations on an initially empty dispenser leaves the dispenser empty. The sequence may include "try_pop" operations at points where the dispenser will be empty.

OCaml

Innovation. Community. Security.