package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-shell-libs.shell-benchmarks/Tezos_shell_benchmarks/Io_helpers/index.html
Module Tezos_shell_benchmarks.Io_helpers
Source
Helpers for loading contexts, saving contexts, writing to contexts, etc. Also contains the Key_map
module, heavily used for preparing benchmarks and computing statistics.
val commit :
Tezos_protocol_environment.Context.t ->
Tezos_base.TzPervasives.Context_hash.t Lwt.t
val flush :
Tezos_protocol_environment.Context.t ->
Tezos_protocol_environment.Context.t Lwt.t
val prepare_empty_context :
string ->
(Tezos_base.TzPervasives.Context_hash.t, Tezos_base.TzPervasives.tztrace)
result
Lwt.t
val load_context_from_disk :
string ->
Tezos_base.TzPervasives.Context_hash.t ->
Tezos_protocol_environment.Context.t * Tezos_context.Context.index
val with_context :
base_dir:string ->
context_hash:Tezos_base.TzPervasives.Context_hash.t ->
(Tezos_protocol_environment.Context.t -> 'a Lwt.t) ->
'a
val initialize_key :
Random.State.t ->
Tezos_protocol_environment.Context.t ->
Tezos_protocol_environment.Context.key ->
int ->
Tezos_protocol_environment.Context.t Lwt.t
This function updates the context with random bytes at a given depth.
val commit_and_reload :
string ->
Tezos_context.Context.index ->
Tezos_protocol_environment.Context.t ->
(Tezos_protocol_environment.Context.t * Tezos_context.Context.index) Lwt.t
Maps 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
* Tezos_base.TzPervasives.Block_hash.t
* Tezos_base.TzPervasives.Context_hash.t)
Tezos_base.TzPervasives.tzresult
Lwt.t
load_head_block data_dir
takes the path of the Tezos node data directory (typically $HOME/.tezos-node
) and returns the information of the current head.
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:Random.State.t ->
restrict_memory:(unit -> unit) ->
Tezos_protocol_environment.Context.t ->
(Tezos_protocol_environment.Context.key * _) array list ->
unit Lwt.t
fill_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.