17.3 Printing profiling information

The ocamlprof command produces a source listing of the program modules where execution counts have been inserted as comments. For instance,

ocamlprof foo.ml

prints the source code for the foo module, with comments indicating how many times the functions in this module have been called. Naturally, this information is accurate only if the source file has not been modified since the profiling execution took place.

The following options are recognized by ocamlprof:

-f dumpfile

Specifies an alternate dump file of profiling information to be read.

-F string

Specifies an additional string to be output with profiling information. By default, ocamlprof will annotate programs with comments of the form (* n *) where n is the counter value for a profiling point. With option -F s, the annotation will be (* sn *).

-impl sourcefile

Treat sourcefile as an implementation file (i.e. as if its name ended with .ml).

-intf sourcefile

Treat sourcefile as an interface file (i.e. as if its name ended with .mli).

-version

Print the version number of ocamlprof and exit.

-instrument

-m flags

These options are undocumented; they are used internally by ocamlcp.