Module Landmark.Graph
All about exporting profiling results
type kind
=
|
Normal
Usual landmarks
|
Root
The special node that started with the profiling.
|
Counter
Counters (see
Landmark.counter
)|
Sampler
Samplers (set
Landmark.sampler
)The kind of node.
type node
=
{
id : id;
Unique identifier.
kind : kind;
landmark_id : int;
The node is an instance of this landmark.
name : string;
Name of the landmark (see
Landmark.register
).location : string;
Location of the landmark (see
Landmark.register
).calls : int;
Number of time this node was entered.
time : float;
Time (in cycles) spent between enter and exit.
sons : id list;
The list of instances of landmarks that was entered while the node was opened.
sys_time : float;
Time (using Sys.time) spent between enter and exit.
allocated_bytes : float;
Gc.allocated_bytes between enter and exit.
distrib : float array;
For samplers only. The list of collected samples.
}
The type exported view of a node.
Callgraph
type graph
=
{
nodes : node array;
label : string;
}
The type of callgraphs.
Traversal
val path_dfs : (bool -> node list -> node -> unit) -> (node list -> node -> unit) -> graph -> unit
path_dfs f g graph
traverses the graph in the depth-first fashion starting from the root. At each step we callf visited path v
org path v
wherev
is the visited node andpath
is the path from the root that led us to that node. The functiong
is called when the visited nodev
belongs topath
; it indicates a loop (and the traversal does not continue with the sons of g). The functionf
is called whenv
does not belong topath
. The flagvisited
is true when the vertex has already been visited.
Utility functions
val depth : graph -> node -> int
Returns the depth to the root of the node (it is better to partially apply the function, if you need to call multiple times on the same graph).
val shallow_ancestor : graph -> node -> node
Returns the oldest ancestor of a node that is not the root (if it exists) or the root if it does not exist.
val intensity : ?proj:(node -> float) -> graph -> node -> float
Returns an arbitrary number between 0.0 and 1.0.
val total_number_of_calls : graph -> int
Computes the sum of all calls field.
Simplification / Merge / Quotienting.
Output
val output : ?threshold:float -> Stdlib.out_channel -> graph -> unit
Pretty printed output a call graph on an out_channel.
val output_json : Stdlib.out_channel -> graph -> unit
Outputs a JSON representation of a call graph on an out_channel.