1Spacetime(3) OCamldoc Spacetime(3)
2
3
4
6 Spacetime - Profiling of a program's space behaviour over time.
7
9 Module Spacetime
10
12 Module Spacetime
13 : sig end
14
15
16 Profiling of a program's space behaviour over time. Currently only
17 supported on x86-64 platforms running 64-bit code.
18
19 To use the functions in this module you must:
20
21 -configure the compiler with "-spacetime";
22
23 -compile to native code. Without these conditions being satisfied the
24 functions in this module will have no effect.
25
26 Instead of manually taking profiling heap snapshots with this module it
27 is possible to use an automatic snapshot facility that writes profiling
28 information at fixed intervals to a file. To enable this, all that
29 needs to be done is to build the relevant program using a compiler con‐
30 figured with -spacetime; and set the environment variable OCAML_SPACE‐
31 TIME_INTERVAL to an integer number of milliseconds giving the interval
32 between profiling heap snapshots. This interval should not be made
33 excessively small relative to the running time of the program. A typi‐
34 cal interval to start with might be 1/100 of the running time of the
35 program. The program must exit "normally" (i.e. by calling exit , with
36 whatever exit code, rather than being abnormally terminated by a sig‐
37 nal) so that the snapshot file is correctly completed.
38
39 When using the automatic snapshot mode the profiling output is written
40 to a file called "spacetime-<pid>" where <pid> is the process ID of the
41 program. (If the program forks and continues executing then multiple
42 files may be produced with different pid numbers.) The profiling out‐
43 put is by default written to the current working directory when the
44 program starts. This may be customised by setting the OCAML_SPACE‐
45 TIME_SNAPSHOT_DIR environment variable to the name of the desired
46 directory.
47
48 If using automatic snapshots the presence of the save_event_for_auto‐
49 matic_snapshots function, below, should be noted.
50
51 The functions in this module are thread safe.
52
53 For functions to decode the information recorded by the profiler, see
54 the Spacetime offline library in otherlibs/.
55
56
57
58
59
60
61 val enabled : bool
62
63
64 enabled is true if the compiler is configured with spacetime and false
65 otherwise
66
67
68 module Series : sig end
69
70
71
72
73 module Snapshot : sig end
74
75
76
77
78
79 val save_event_for_automatic_snapshots : event_name:string -> unit
80
81 Like Spacetime.Series.save_event , but writes to the automatic snapshot
82 file. This function is a no-op if OCAML_SPACETIME_INTERVAL was not
83 set.
84
85
86
87
88
892018-04-14 source: Spacetime(3)