table of contents
OCAMLCP(1) | General Commands Manual | OCAMLCP(1) |
NAME¶
ocamlcp, ocamloptp - The OCaml profiling compilers
SYNOPSIS¶
ocamlcp[ocamlc options][-P flags]filename ...
ocamloptp[ocamlopt options][-P flags]filename ...
DESCRIPTION¶
Theocamlcpandocamloptpcommands are front-ends toocamlc(1)andocamlopt(1)that instrument the source code, adding code to record how many timesfunctions are called, branches of conditionals are taken, etc.Execution of instrumented code produces an execution profile in thefile ocamlprof.dump, which can be read usingocamlprof(1).
ocamlcpaccepts the same arguments and options asocamlc(1)andocamloptpaccepts the same arguments and options asocamlopt(1).There is only one exception: in both cases, the-ppoption is not supported. If you need to preprocess your source files,you will have to do it separately before callingocamlcporocamloptp.
OPTIONS¶
In addition to theocamlc(1)orocamlopt(1)options,ocamlcpandocamloptpaccept one option to control the kind of profiling information, the-P lettersoption. Thelettersindicate which parts of the program should be profiled:
- a
- all options
- f
- function calls: a count point is set at the beginning of each function body
- i
- if ... then ... else: count points are set in boththen and elsebranches
- l
- while, forloops: a count point is set at the beginning of the loop body
- m
- matchbranches: a count point is set at the beginning of thebody of each branch of a pattern-matching
- t
- try ... withbranches: a count point is set at the beginning of the body of eachbranch of an exception catcher
For instance, compiling withocamlcp -P filmprofiles function calls,if ... then ... else ...,loops, and pattern matching.
Callingocamlcp(1)orocamloptp(1)without the-Poption defaults to-P fm,meaning that only function calls and pattern matching are profiled.
Note: for compatibility with previous versions,ocamlcp(1)also accepts the option-pwith the same argument and meaning as-P.
SEEALSO¶
ocamlc(1), ocamlopt(1), ocamlprof(1).
The OCaml user's manual,chapter
"Profiling".