package core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Allocation_report : sig ... end
val measure_allocation : (Base.Unit.t -> 'a) -> 'a * Allocation_report.t

measure_allocation f measures the words allocated by running f ()

val measure_allocation_local : (Base.Unit.t -> 'a) -> 'a * Allocation_report.t

Same as measure_allocation, but for functions that return a local value.

module Allocation_log : sig ... end
val measure_and_log_allocation : (Base.Unit.t -> 'a) -> 'a * Allocation_report.t * Allocation_log.t Base.List.t

measure_and_log_allocation f logs each allocation that f () performs, as well as reporting the total. (This can be slow if f allocates heavily).

This function is only supported since OCaml 4.11. On prior versions, the function always returns an empty log.

val measure_and_log_allocation_local : (Base.Unit.t -> 'a) -> 'a * Allocation_report.t * Allocation_log.t Base.List.t

Same as measure_and_log_allocation, but for functions that return a local value.

val is_zero_alloc : (Base.Unit.t -> _) -> Base.Bool.t

is_zero_alloc f runs f () and returns true if it does not allocate, or false otherwise. is_zero_alloc does not allocate.

val is_zero_alloc_local : (Base.Unit.t -> _) -> Base.Bool.t

Same as is_zero_alloc, but for functions that return a local value.

val assert_no_allocation : Source_code_position.t -> (Base.Unit.t -> 'a) -> 'a

assert_no_allocation [%here] f raises if f allocates.

val assert_no_allocation_local : Source_code_position.t -> (Base.Unit.t -> 'a) -> 'a

Same as assert_no_allocation, but for functions that return a local value.

OCaml

Innovation. Community. Security.