Mavryk_shell_benchmarks.Io_helpersHelpers for loading contexts, saving contexts, writing to contexts, etc. Also contains the Key_map module, heavily used for preparing benchmarks and computing statistics.
val assert_ok : msg:string -> 'a Mavryk_base.TzPervasives.tzresult -> 'aval commit :
Mavryk_protocol_environment.Context.t ->
Mavryk_base.TzPervasives.Context_hash.t Lwt.tval flush :
Mavryk_protocol_environment.Context.t ->
Mavryk_protocol_environment.Context.t Lwt.tval prepare_empty_context :
string ->
(Mavryk_base.TzPervasives.Context_hash.t, Mavryk_base.TzPervasives.tztrace)
Stdlib.result
Lwt.tval load_context_from_disk :
string ->
Mavryk_base.TzPervasives.Context_hash.t ->
Mavryk_protocol_environment.Context.t * Mavryk_context.Context.indexval with_context :
base_dir:string ->
context_hash:Mavryk_base.TzPervasives.Context_hash.t ->
(Mavryk_protocol_environment.Context.t -> 'a Lwt.t) ->
'aval initialize_key :
Stdlib.Random.State.t ->
Mavryk_protocol_environment.Context.t ->
Mavryk_protocol_environment.Context.key ->
int ->
Mavryk_protocol_environment.Context.t Lwt.tThis function updates the context with random bytes at a given depth.
val commit_and_reload :
string ->
Mavryk_context.Context.index ->
Mavryk_protocol_environment.Context.t ->
(Mavryk_protocol_environment.Context.t * Mavryk_context.Context.index) Lwt.tmodule Key_map : sig ... endMaps from string lists to bytes. No balancing. A key cannot be a prefix or a suffix to another key.
Split a absolute path name.
For example, split_absolute_pat "/a/b/c" = Some ["a"; "b"; "c"]. It returns None for illigal paths such as "a/b/c", "/a/../b" and "/a/b/.".
Purge disk cache.
This function assumes Linux OS and purge_disk_cache.exe is placed at the current directory, owned by root with setuid. The source code for purge_disk_cache.exe is available at devtools/benchmarks-tools/purge_disk_cache/.
Even if the function fails to execute the command, it does NOT fail but prints just a warning.
val load_head_block :
string ->
(int32
* Mavryk_base.TzPervasives.Block_hash.t
* Mavryk_base.TzPervasives.Context_hash.t)
Mavryk_base.TzPervasives.tzresult
Lwt.tload_head_block data_dir takes the path of the Mavryk node data directory (typically $HOME/.mavryk-node) and returns the information of the current head.
module Meminfo : sig ... endReading /proc/meminfo. Only for Linux
with_memory_restriction gib f executes f trying to restrict the MemAvailable of /proc/meminfo to gib GiB. It only works in Linux.
Function f takes a function to re-restrict the MemAvailable during the exection of f.
val fill_disk_cache :
rng:Stdlib.Random.State.t ->
restrict_memory:(unit -> unit) ->
Mavryk_protocol_environment.Context.t ->
(Mavryk_protocol_environment.Context.key * _) array list ->
unit Lwt.tfill_disk_cache ~rng ~restrict_memory context keys loads keys in context randomly, until Linux kernel's disk cache is completely filled.
restrict_memory is the function obtained by with_memory_restriction. It is used to keep the amount of MemAvailable at the same level.