Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / ShowProf.adoc
1 ShowProf
2 ========
3
4 If an executable is compiled for <:Profiling:profiling>, then it
5 accepts a special command-line runtime system argument, `show-prof`,
6 that outputs information about the source functions that are profiled.
7 Normally, this information is used by `mlprof`. This page documents
8 the `show-prof` output format, and is intended for those working on
9 the profiler internals.
10
11 The `show-prof` output is ASCII, and consists of a sequence of lines.
12
13 * The magic number of the executable.
14 * The number of source names in the executable.
15 * A line for each source name giving the name of the function, a tab,
16 the filename of the file containing the function, a colon, a space,
17 and the line number that the function starts on in that file.
18 * The number of (split) source functions.
19 * A line for each (split) source function, where each line consists of
20 a source-name index (into the array of source names) and a successors
21 index (into the array of split-source sequences, defined below).
22 * The number of split-source sequences.
23 * A line for each split-source sequence, where each line is a space
24 separated list of (split) source functions.
25
26 The latter two arrays, split sources and split-source sequences,
27 define a directed graph, which is the call-graph of the program.