Debian Codegraph @

doc/guide/src/MLtonRusage.adoc

raw
1 = MLtonRusage
2
3 [source,sml]
4 ----
5 signature MLTON_RUSAGE =
6 sig
7 type t = {utime: Time.time, (* user time *)
8 stime: Time.time} (* system time *)
9
10 val measureGC: bool -> unit
11 val rusage: unit -> {children: t, gc: t, self: t}
12 end
13 ----
14
15 * `type t`
16 +
17 corresponds to a subset of the C `struct rusage`.
18
19 * `measureGC b`
20 +
21 controls whether garbage collection time is separately measured during
22 program execution. This affects the behavior of both `rusage` and
23 `Timer.checkCPUTimes`, both of which will return gc times of zero with
24 `measureGC false`. Garbage collection time is always measured when
25 either `gc-messages` or `gc-summary` is given as a
26 <<RunTimeOptions#,runtime system option>>.
27
28 * `rusage ()`
29 +
30 corresponds to the C `getrusage` function. It returns the resource
31 usage of the exited children, the garbage collector, and the process
32 itself. The `self` component includes the usage of the `gc`
33 component, regardless of whether `measureGC` is `true` or `false`. If
34 `rusage` is used in a program, either directly, or indirectly via the
35 `Timer` structure, then `measureGC true` is automatically called at
36 the start of the program (it can still be disable by user code later).