1OCAMLCP(1) General Commands Manual OCAMLCP(1)
2
3
4
6 ocamlcp, ocamloptp - The OCaml profiling compilers
7
8
10 ocamlcp [ ocamlc options ] [ -P flags ] filename ...
11
12 ocamloptp [ ocamlopt options ] [ -P flags ] filename ...
13
14
16 The ocamlcp and ocamloptp commands are front-ends to ocamlc(1) and
17 ocamlopt(1) that instrument the source code, adding code to record how
18 many times functions are called, branches of conditionals are taken,
19 etc. Execution of instrumented code produces an execution profile in
20 the file ocamlprof.dump, which can be read using ocamlprof(1).
21
22 ocamlcp accepts the same arguments and options as ocamlc(1) and ocam‐
23 loptp accepts the same arguments and options as ocamlopt(1). There is
24 only one exception: in both cases, the -pp option is not supported. If
25 you need to preprocess your source files, you will have to do it sepa‐
26 rately before calling ocamlcp or ocamloptp.
27
28
30 In addition to the ocamlc(1) or ocamlopt(1) options, ocamlcp and ocam‐
31 loptp accept one option to control the kind of profiling information,
32 the -P letters option. The letters indicate which parts of the program
33 should be profiled:
34
35 a all options
36
37 f function calls : a count point is set at the beginning of each
38 function body
39
40 i if ... then ... else: count points are set in both then and else
41 branches
42
43 l while, for loops: a count point is set at the beginning of the
44 loop body
45
46 m match branches: a count point is set at the beginning of the
47 body of each branch of a pattern-matching
48
49 t try ... with branches: a count point is set at the beginning of
50 the body of each branch of an exception catcher
51
52
53 For instance, compiling with ocamlcp -P film profiles function calls,
54 if ... then ... else ..., loops, and pattern matching.
55
56 Calling ocamlcp(1) or ocamloptp(1) without the -P option defaults to
57 -P fm, meaning that only function calls and pattern matching are pro‐
58 filed.
59
60 Note: for compatibility with previous versions, ocamlcp(1) also accepts
61 the option -p with the same argument and meaning as -P.
62
63
65 ocamlc(1), ocamlopt(1), ocamlprof(1).
66 The OCaml user's manual, chapter "Profiling".
67
68
69
70 OCAMLCP(1)