package tezos-benchmark

  1. Overview
  2. Docs

The Registration module contains functions regarding the registration of benchmarks, models, parameters and commands for the Snoop tool.

exception Benchmark_not_found of Namespace.t
exception Model_not_found of Namespace.t
exception Local_model_not_found of Tezos_base.TzPervasives.String.t
exception Parameter_not_found of Free_variable.t

Types of the registered informations for each kind of item. These informations are retrieved with the query functions all_* and find_* defined below

type benchmark_info = Benchmark.t

The information registered for a benchmark is the benchmark itself

type model_info = {
  1. model : Model.packed_model;
  2. from : local_model_info list;
}

We only register abstract models. For each of them, we store the model itself, as well as each of its occurences in benchmarks

and local_model_info = {
  1. bench_name : Namespace.t;
  2. local_model_name : string;
}

We only store the name of the benchmark and the local name of the model, as it is enough information to retrieve the associated model

type parameter_info = Namespace.t list

For each parameter, we register the list of models (by name) in which they occur

val register : ?add_timer:bool -> Benchmark.t -> unit

Register a benchmark. Recursively registers any relevant model and parameter included in it. Add timer latency to the model if add_timer is true (default). It is expected that add_timer is set to false when registering a benchmark which uses Calculated.

val register_simple : ?add_timer:bool -> Benchmark.simple -> unit

Register a Benchmark.Simple. Recursively registers any relevant model and parameter included in it.

val register_simple_with_num : ?add_timer:bool -> Benchmark.simple_with_num -> unit

Register a Benchmark.Simple_with_num. Recursively registers any relevant model and parameter included in it.

val register_model_for_code_generation : string -> 'a Model.t -> unit

register_model_for_code_generation s model registers a model model with a local model name s for code generation. Use register if a model is associated with a benchmark.

val add_command : unit Tezos_clic.command -> unit

Register a Tezos_clic.command for the command line

val all_benchmarks : unit -> (Namespace.t * benchmark_info) list

Returns the list of all registered benchmarks

val all_models : unit -> (Namespace.t * model_info) list

Returns the list of all registered models

val all_parameters : unit -> (Free_variable.t * parameter_info) list

Returns the list of all registered parameters

val all_custom_commands : unit -> unit Tezos_clic.command list

Returns the list of all registered commands

val all_tags : unit -> string list

Returns the list of all the tags from registered benchmarks

val all_model_names : unit -> Namespace.t list

Returns the list of all the model names Same as all_models () |> List.map fst

val all_local_model_names : unit -> string list

Returns the list of all local model names as they appear in registered benchmarks

val find_benchmarks_with_tags : mode:[< `All | `Exact | `Any ] -> string list -> (Namespace.t * benchmark_info) list

find_benchmarks_with_tags ~mode tag_list returns all the benchmarks which tags match the given tag_list with the given mode. `All means all tags in tag_list appear in the tags of the returned benchmarks `Exact means the returned benchmarks' tags match exactly with tag_list `Any means the returned benchmarks have at least one tag also present in tag_list

The following query functions take a string as input. This string is converted into a Namespace.t with Namespace.of_string. This conversion is then returned as output. This ensures that the returned Namespace.t values correspond to registered items.

val find_benchmark : Namespace.t -> benchmark_info option

find_benchmark s returns Some (name,b) with name = s if the benchmark b is named name and has been registered, else returns None

val find_benchmark_exn : Namespace.t -> benchmark_info

find_benchmark_exn s returns (name,b) with name = s if the benchmark b is named name and has been registered, else raises the exception Benchmark_not_founds

val find_benchmarks_in_namespace : Namespace.t -> (Namespace.t * benchmark_info) list

find_benchmarks_in_namespace s returns all registered benchmarks which name has s as a parent namespace. For instance, if two benchmarks a/b/bench1 and a/b/bench2 are registered, then

  • if s = a or s = a/b, then the function returns both benchmarks
  • if s = a/b/bench, the empty list is returned
  • if s = a/b/bench1, then a/b/bench1 is returned
val find_model : Namespace.t -> model_info option

find_model s returns Some (name,m) with name = s if the model of m is named name and has been registered, else returns None

val find_model_exn : Namespace.t -> model_info

find_model_exn s returns (name,m) with name = s if the model of m is named name and has been registered, else raises the exception Local_model_not_founds

val find_local_model : Tezos_base.TzPervasives.String.t -> Namespace.t list option

find_local_model s returns the list of benchmark names whose local model name is s, if the latter has been registered, else returns None

val find_local_model_exn : Tezos_base.TzPervasives.String.t -> Namespace.t list

find_local_model s returns the list of benchmark names whose local model name is s, if the latter has been registered, else raises the exception Model_not_founds

val find_models_in_namespace : Namespace.t -> (Namespace.t * model_info) list

find_models_in_namespace s returns all registered models which name has s as a parent namespace.

val find_parameter : Free_variable.t -> parameter_info option

find_parameter s returns Some (name,p) if the parameter name = s has been registered, and p is the registered info on s, else returns None

val find_parameter_exn : Free_variable.t -> parameter_info

find_parameter_exn s returns (name,p) if the parameter name = s has been registered, and p is the registered info on s, else raises the exception Parameter_not_founds

val find_parameters_in_namespace : Namespace.t -> (Free_variable.t * parameter_info) list

find_parameters_in_namespace s returns all registered info for parameters which name has s as a parent namespace.

OCaml

Innovation. Community. Security.