1
2
3OCAMLCP(1)                  General Commands Manual                 OCAMLCP(1)
4
5
6

NAME

8       ocamlcp - The Objective Caml profiling compiler
9
10

SYNOPSIS

12       ocamlcp [ ocamlc options ] [ -p flags ] filename ...
13
14

DESCRIPTION

16       The  ocamlcp  command  is a front-end to ocamlc(1) that instruments the
17       source code, adding code to record how many times functions are called,
18       branches of conditionals are taken, ...  Execution of instrumented code
19       produces an execution profile in the file ocamlprof.dump, which can  be
20       read using ocamlprof(1).
21
22       ocamlcp accepts the same arguments and options as ocamlc(1).
23
24

OPTIONS

26       In  addition  to  the  ocamlc(1) options, ocamlcp accepts the following
27       option controlling the amount of profiling information:
28
29       -p letters
30              The letters indicate which parts of the program should  be  pro‐
31              filed:
32
33       a      all options
34
35       f      function  calls  : a count point is set at the beginning of each
36              function body
37
38       i      if ... then ... else: count points are set in both then and else
39              branches
40
41       l      0 loops: a count point is set at the beginning of the loop body
42
43       m      match  branches:  a  count  point is set at the beginning of the
44              body of each branch of a pattern-matching
45
46       t      try ... with branches: a count point is set at the beginning  of
47              the body of each branch of an exception catcher
48
49
50       For  instance,  compiling  with ocamlcp -pfilm profiles function calls,
51       if ... then ... else ..., loops, and pattern matching.
52
53       Calling ocamlcp(1) without the -p option defaults to -p fm meaning that
54       only function calls and pattern matching are profiled.
55
56       Note:  due to the implementation of streams and stream patterns as syn‐
57       tactic sugar, it is hard to predict what parts  of  stream  expressions
58       and  patterns  will  be profiled by a given flag.  To profile a program
59       with streams, we recommend using ocamlcp -p a.
60
61

SEE ALSO

63       ocamlc(1), ocamlprof(1).
64       The Objective Caml user's manual, chapter "Profiling".
65
66
67
68                                                                    OCAMLCP(1)
Impressum