module Tree:sig..end
type t
Benchmark.throughputN, Benchmark.latencyN, etc. wrapped with
(>:)) can appear at any node of the tree. The edges are
annotated with strings, and paths (see Benchmark.Tree.path) are used to
select subtrees.val (@>) : string -> Benchmark.samples Lazy.t -> tname @> bench returns a (named) node of the benchmark tree.
If evaluated, it simply returns samples (for instance using
Benchmark.throughputN). If the name contains dots, it is interpreted
as a path. For examle "a.b" @> bench is equivalent to "a" @>>
"b" @> bench.
Example (the lazy thunk is used to hide initialization code):
Benchmark.Tree.(
"sort" >: lazy
(let a = Array.init 1_000_000 (fun i -> i) in
Benchmark.throughput1 18 (Array.sort compare) a
)
) ;;
val (@>>) : string -> t -> tname >:: tree makes tree accessible through the given
name, i.e., prefix all paths in the tree by name. It has no
effect if name = "". If the name contains dots, it is
interpreted as a path. For instance "n1.n2" @>> tree is
equivalent to "n1" @>> "n2" @>> tree and adds the path
[n1;n2] as a prefix to the tree.Invalid_argument is the name is invalid. At least names
corresponding to OCaml identifiers are valid.val concat : t list -> tx,
merging recursively all subtrees reachable under x.
For instance merging the trees a.{b, c}, a.b.d and {a.d, foo}
will give the tree {a.(b, b.d, c, d}, d}.
val (@>>>) : string -> t list -> tname @>>> l is equivalent to name >:: concat l. It names a list of
trees, and is useful to build lists of benchmarks related to some
common topic. If the name contains dots, it is interpreted
as a path.Invalid_argument is the name is invalid. At least names
corresponding to OCaml identifiers are valid.val with_int : (int -> t) -> int list -> twith_int f l parametrize trees with several integer values
(e.g. a size). The tree f i is prefixed with the label i.val print : Format.formatter -> t -> unitpath argument of Benchmark.Tree.runtypepath =string list
val print_path : Format.formatter -> path -> unit
val parse_path : string -> pathparse_path "a.b.c" returns ["a"; "b"; "c"].val prefix : path -> t -> t>::.val filter : path -> t -> tfilter p t return the tree obtained by keeping all the paths
in t that match the path p.
Empty components "" in the middle of the path are ignored.
Empty components "" at the end of the path return only the
benchmarks at that level (i.e., one discards the benchmarks
pointed by paths of which p is a strict prefix).
The special path component "*" selects all subtrees at that
level (it acts as a wildcard).type arg_state
val arg : unit -> arg_state * (Arg.key * Arg.spec * Arg.doc) listarg () returns (arg, specs) where arg is a state coming
from parsing the command line using specs. The options are:Arg.parse (specs @ more_specs) ... to make
the above arguments available to the program user.val run : ?arg:arg_state ->
?paths:path list ->
?out:Format.formatter -> t -> unitrun t runs all benchmarks of t and print the results to fmt.arg : use the result of the command line parsing to direct
the run. Default: run all paths in pathpaths : if provided, only the sub-trees corresponding to
these path is executed. Default: execute everything.out : The formatter on which to print the output.
Default: Format.std_formatter.val global : unit -> tBenchmark.Tree.register. It is useful
to centralize all benchmarks at one place to, then, run them allval register : t -> unitval run_global : ?argv:string array -> ?out:Format.formatter -> unit -> unitBenchmark.Tree.run on the global tree of benchmarks and parsing the
command line arguments from argv (which is Sys.argv by
default).