package landmarks
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=d616cd1430badbaa72388c24fd78b974b75a160a875f2e7a630c34370f448d47
md5=92e0f9442d8ea91915bee492b1bb1655
doc/landmarks.threads/Landmark_threads/index.html
Module Landmark_threads
Protects landmarks against concurrency.
This module implements of wrapper around some of the primitives of the Landmark module in order to prevent concurrent thread to enter landmarks. Only one thread may be benchmarked at a time, the one which started the profiling. Other calls to the primitives outside this thread behaves as ignore.
It requires the Thread module (and only available in 'landmarks-threads' archive.
include module type of Landmark
with type landmark = Landmark.landmark
and type sampler = Landmark.sampler
and type counter = Landmark.counter
module Graph = Landmark.GraphThe main module
val clock : unit -> Int64.tThis function is used by the landmark infrastructure to measure the number of cycles inside landmarks.
Landmarks
Landmarks identify portions of code, they are registered with the function register and delimited by enter and exit.
type landmark = Landmark.landmarkThe type of landmarks.
val register : ?location:string -> string -> landmarkregister name registers a new landmark. Should always be called at top-level.
val enter : landmark -> unitBegins a landmark block. /!\ Landmark blocks should be well-nested, otherwise a failure will be raised during profiling.
val exit : landmark -> unitEnds a landmark block.
val wrap : landmark -> ('a -> 'b) -> 'a -> 'bPuts landmark blocks around a function (and close the block and re-raise in case of uncaught exception).
val unsafe_wrap : landmark -> ('a -> 'b) -> 'a -> 'bPuts landmark blocks around a function without catching exceptions.
Counter and samplers
Counters are similar to landmarks except they represent empty pieces of code. Their only primitive is increment which adds a constant to the field calls. Samplers are used to collect floats.
type counter = Landmark.counterThe type of counters.
val register_counter : string -> counterregister_counter name registers a new counter. Should always be called at top-level.
val increment : ?times:int -> counter -> unitIncrements the number of calls attached to the counter.
type sampler = Landmark.samplerThe type of samplers.
val register_sampler : string -> samplerregister_counter name registers a new sampler.
val sample : sampler -> float -> unitCollects a float.
Manage profiling
type profile_output = | Silent(*Disables the automatic output of profiling results when the program ends.
*)| Temporary of string option(*Writes the results in a temporary files and prints its path on stderr.
*)| Channel of out_channel(*Writes in the results in out_channel.
*)
Where to output results.
type profile_format = | JSON(*Easily parsable export format.
*)| Textual of textual_option(*Console friendly output; nodes below the threshold (0.0 <= threshold <= 100.0) are not displayed in the callgraph.
*)
The output format for the results.
type profiling_options = {debug : bool;(*Activates a verbose mode that outputs traces on stderr each time the landmarks primitives are called. Default: false.
*)allocated_bytes : bool;sys_time : bool;recursive : bool;(*When false, the recursive instances of landmarks (entering a landmark that has already been entered) are ignored (the number of calls is updated but it does not generate a new node in the callgraph).
*)output : profile_output;(*Specify where to output the results.
*)format : profile_format;(*Specify the output format.
*)
}The profiling options control the behavior of the landmark infrastructure.
val default_options : profiling_optionsThe default profiling_options.
val set_profiling_options : profiling_options -> unitSets the options.
val profiling_options : unit -> profiling_optionsGet the options.
val start_profiling : ?profiling_options:profiling_options -> unit -> unitStarts the profiling.
val export : ?label:string -> unit -> Graph.graphExport the profiling information of the current process.
val export_and_reset : ?label:string -> unit -> Graph.graphExport the profiling information of the current process; then reset internal state.
val merge : Graph.graph -> unitAggregate the profiling information (exported by another process) to the current one. This should is used by the master process to merge exported profiles of workers.
Save the state of the profiler on a stack to be retrieved later by pop_profiling_state ().