Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / MLmon.adoc
1 MLmon
2 =====
3
4 An `mlmon.out` file records dynamic <:Profiling:profiling> counts.
5
6 == File format ==
7
8 An `mlmon.out` file is a text file with a sequence of lines.
9
10 * The string "`MLton prof`".
11
12 * The string "`alloc`", "`count`", or "`time`", depending on the kind
13 of profiling information, corresponding to the command-line argument
14 supplied to `mlton -profile`.
15
16 * The string "`current`" or "`stack`" depending on whether profiling
17 data was gathered for only the current function (the top of the stack)
18 or for all functions on the stack. This corresponds to whether the
19 executable was compiled with `-profile-stack false` or `-profile-stack
20 true`.
21
22 * The magic number of the executable.
23
24 * The number of non-gc ticks, followed by a space, then the number of
25 GC ticks.
26
27 * The number of (split) functions for which data is recorded.
28
29 * A line for each (split) function with counts. Each line contains an
30 integer count of the number of ticks while the function was current.
31 In addition, if stack data was gathered (`-profile-stack true`), then
32 the line contains two additional tick counts:
33
34 ** the number of ticks while the function was on the stack.
35 ** the number of ticks while the function was on the stack and a GC
36 was performed.
37
38 * The number of (master) functions for which data is recorded.
39
40 * A line for each (master) function with counts. The lines have the
41 same format and meaning as with split-function counts.