# Using ocamloptp (for profiling) with Dune?

**URL:** <https://discuss.ocaml.org/t/using-ocamloptp-for-profiling-with-dune/2844>\
**Category:** Ecosystem\
**Tags:** dune\
**Created:** [November 7, 2018, 11:39am UTC](https://discuss.ocaml.org/t/using-ocamloptp-for-profiling-with-dune/2844 "2018-11-07T11:39:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lindig](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/lindig/32/532_2.png) [@lindig](https://discuss.ocaml.org/u/lindig)\
**Post date:** [November 7, 2018, 11:39am UTC](https://discuss.ocaml.org/t/using-ocamloptp-for-profiling-with-dune/2844/1 "2018-11-07T11:39:44Z")

</div>

What is the recommended way to use the native code profiler in a Dune project? There is an [open issue](https://github.com/ocaml/dune/issues/398) but the proposed workaround is not clear. The problem is that rather than `ocamlopt` a different compiler must be invoked.

I believe a potential easy way is to define a profile in a top-level `dune` file that adds the `-p` flag to the invocation of `ocamlopt` which is equivalent with calling `ocamloptp`.

```auto
(env
 (profile
  (ocamlopt_flags (:standard -p -w -27-32-52-33-34-37-39))
  (flags (:standard -w -27-32-52-33-34-37-39)))
 (dev
  (flags (:standard -w -27-32-52-33-34-37-39)))
 (release
  (flags (:standard -w -27-32-52-33-34-37-39))))

```

There seems to be a problem with using `-p` on macOS – [reported here](https://github.com/RedPRL/redtt/issues/387) – which I also ran into.
