Module Mavryk_benchmark.Namespace

Namespace implements a type for the name of the benchmarks in Snoop It can be seen as a path of several names, similar to a file system

type t

The type of the namespaces

val encoding : t Mavryk_base.TzPervasives.Data_encoding.t
val empty : t

The empty namespace, printed as "."

val equal : t -> t -> bool
val is_empty : t -> bool
val is_singleton : t -> bool

Tests if the namespace contains only one name

val compare : t -> t -> int
val hash : t -> int
val to_string : t -> string
val of_string : string -> t
val to_filename : t -> string

String representation without '/', usable for file names. It is usable for Graphviz vertex names with String.escaped.

Example: to_filename (of_string "foo/bar/gee.txt") = "foo__bar__gee.txt"

type cons = string -> t

The type of namespace constructors, which represent intermediate namespaces. Given a string, it returns a terminal namespace which is then used for benchmark names.

val cons : t -> string -> t
val root : cons

The basic constructor for namespaces, at the root of every other namespace. root "bench" would return the namespace "bench" for a benchmark

val make : cons -> string -> cons

Creates a constructor by appending a name to another constructor If ns represents the namespace A/B/C/, then make ns "D" would return the constructor for the namespace A/B/C/D/

val basename : t -> string

Returns the basename of t, which is the name furthest from the root. basename empty is ".". basename (cons s) is s for any constructor cons.

val to_list : t -> string list

Returns the path of n as a list. The head of the list is the start of the path, which is always ".". If n is empty, only returns ["."]. Never returns the empty list.

val of_list : string list -> t

Returns a path represented by the given list. If the first element is ".", removes it. Checks that all elements don't contain '/'.

val name_match : t -> t -> bool

name_match pattern name returns true if and only if pattern is a prefix of name.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty printer

val pp_short : Stdlib.Format.formatter -> t -> unit

Short printer that only prints the basename of the namespace