Txin
Txin

Reputation: 43

How to configure _oasis for OCaml to set 'Profile' flag

I have an existing project in OCaml and one _oasis file. I don't know where to enable the profiling flag for ocamlbuild.

I looked up Oasis manual and the code, and found there was a variable profile available in setup.data. I assume this was what Oasis auto generated.

Where and what should I include in _oasis to set profile to true ?

Upvotes: 4

Views: 303

Answers (3)

lambda.xy.x
lambda.xy.x

Reputation: 4998

You can enable the oasis profile flag by adding the --enable-profile argument to the ./configure flag. But so far, I have only noticed any effect when I enabled native code compilation (CompiledObject: native in _oasis). Even then, the profiling generation is only done for gprof.

Upvotes: 1

ivg
ivg

Reputation: 35280

I suggest you to use _tags file as it is the easiest way. Just add the following to your _tags:

<true> : profile

You run this command:

echo "<true> : profile" >> _tags

in the folder where your _tags file is located.

If you still want to use _oasis file, then you can use NativeOpt field, to add options that will be passed to native compiler, i.e., ocamlopt.

Upvotes: 0

PatJ
PatJ

Reputation: 6144

You can activate the ocamlbuild_more_args feature.

On top of your _oasis file:

AlphaFeatures: ocamlbuild_more_args

Then, in your Package:

XOCamlbuildExtraArgs: your_ocamlbuild_option

I can't find any -profile option in ocamlbuild though, so I'm not sure of what this is about. Also, this option is still quite unstable.

A better way to handle that would be to modify your _tags file accordingly. It is generated by oasis but you can modify it.

EDIT:

setup.data informs you of environment variables. As for profile, it shows if the -p option will be passed to ocamlopt. You can pass it using the NativeOpt field.

Upvotes: 3

Related Questions