Mavryk_benchmark.RegistrationThe Registration module contains functions regarding the registration of benchmarks, models, parameters and commands for the Snoop tool.
exception Benchmark_not_found of Namespace.texception Model_not_found of Namespace.texception Local_model_not_found of Mavryk_base.TzPervasives.String.texception Parameter_not_found of Free_variable.tTypes 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.tThe information registered for a benchmark is the benchmark itself
type model_info = {model : Model.packed_model;from : local_model_info list;codegen_destination : string option;Specifies the code generation destination for codegen models. If None the detination is determined from the benchmmark the model belongs to.
}We only register abstract models. For each of them, we store the model itself, as well as each of its occurences in benchmarks
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 listFor each parameter, we register the list of models (by name) in which they occur
val register : ?add_timer:bool -> Benchmark.t -> unitRegister 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 -> unitRegister 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 ->
unitRegister a Benchmark.Simple_with_num. Recursively registers any relevant model and parameter included in it.
val register_model_for_code_generation :
?destination:string ->
string ->
'a Model.t ->
unitregister_model_for_code_generation ?destination 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.
destination specifies the code generation destination. If destination = "michelson_v1_gas", the code will be generated to "DIR/michelson_v1_gas_costs_generated.ml" by mavkit-snoop generate code for solutions SOL --split-to DIR command. The command will not generate the code under DIR if destination is not specified.
val add_command : unit Mavryk_clic.command -> unitRegister a Mavryk_clic.command for the command line
val all_benchmarks : unit -> (Namespace.t * benchmark_info) listReturns the list of all registered benchmarks
val all_models : unit -> (Namespace.t * model_info) listReturns the list of all registered models
val all_parameters : unit -> (Free_variable.t * parameter_info) listReturns the list of all registered parameters
val all_custom_commands : unit -> unit Mavryk_clic.command listReturns the list of all registered commands
val all_model_names : unit -> Namespace.t listReturns the list of all the model names Same as all_models () |> List.map fst
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) listfind_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 optionfind_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_infofind_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) listfind_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
s = a or s = a/b, then the function returns both benchmarkss = a/b/bench, the empty list is returneds = a/b/bench1, then a/b/bench1 is returnedval find_model : Namespace.t -> model_info optionfind_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_infofind_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 :
Mavryk_base.TzPervasives.String.t ->
Namespace.t list optionfind_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 :
Mavryk_base.TzPervasives.String.t ->
Namespace.t listfind_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) listfind_models_in_namespace s returns all registered models which name has s as a parent namespace.
val find_parameter : Free_variable.t -> parameter_info optionfind_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_infofind_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) listfind_parameters_in_namespace s returns all registered info for parameters which name has s as a parent namespace.