Mavryk_benchmark.Config
This module implements a schema for a json file that contains the configuration for all the benchmarks registered in Snoop. This configuration file has a tree-like structure that follows the Namespace hierarchy of the benchmarks. Its root element is always ".".
val encoding : t Mavryk_base.TzPervasives.Data_encoding.t
Its encoding
val pp : Stdlib.Format.formatter -> t -> unit
Print t
in JSON
val empty : t
The minimal config file
val build :
(Namespace.t * Mavryk_base.TzPervasives.Data_encoding.json) list ->
t
Build t
from the given bindings
val get_config :
Benchmark.t ->
t ->
Mavryk_base.TzPervasives.Data_encoding.json
Given a benchmark b
and a config c
, get_config b c
returns the configuration for the benchmark b
stored in c
, in json form.
val parse_config :
?print:Stdlib.out_channel ->
('c, 't) Benchmark.poly ->
string option ->
'c
Given a benchmark b
and a file path p
, parse_config b (Some p)
returns the configuration for the benchmark b
stored in the configuration file located in path p
. And parse_config b None
returns the default configuration for b
instead. If print
is specified, the configuration is printed out in print
. Otherwise nothing is printed
val save_config : string -> t -> unit
Save the given config to a file
val generate_default : Benchmark.t list -> t
Given a list of benchmarks l
, generate_default l
generates a default configuration containing all the given benchmarks, and filled with the default configuration for each benchmark
merge_config_files dst src ()
merges the configuration files found at paths dst
and src
, in dst
. If case of conflict, src
overwrites dst
. If delete_src
(default false
) is set to true
, then the file src
is deleted after merging.
val edit_config :
?input:
[< `Stdin
| `String of string
| `File of string
| `Edit of string Edit Stdin ] ->
string ->
Namespace.t ->
unit
edit_config path namespace
edits the config file found at path
, at the location namespace
in the file. input
is the method the json file is edited, which can be either
`Stdin
, reading from the standard input (default)`String s
, parsing a string as a Json document`File f
, using a Json file at path f
`Edit e
, using the given text editor e