# Profiling with Landmarks - setup question

**URL:** <https://discuss.ocaml.org/t/profiling-with-landmarks-setup-question/17983>\
**Category:** Ecosystem\
**Created:** [April 14, 2026, 8:40am UTC](https://discuss.ocaml.org/t/profiling-with-landmarks-setup-question/17983 "2026-04-14T08:40:17Z")\
**Posts on this page:** 2\
**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:** [April 14, 2026, 8:40am UTC](https://discuss.ocaml.org/t/profiling-with-landmarks-setup-question/17983/1 "2026-04-14T08:40:17Z")

</div>

I’m trying to set up a dune project for profiling with [Landmarks](https://github.com/LexiFi/landmarks). Ideally I can compile the project with and without profiling. Landmarks documents a lot of ways to set it up and I struggle to make it work. So far I have:

```auto
==> dune-workspace <==
(lang dune 3.21)
(context default)
(context (default (name profiling) (instrument_with landmarks)))

==> bin/dune <==
(executable
 (name main)
 (public_name vmax)
 (instrumentation (backend landmarks))
 (libraries vmax server cmdliner))

==> lib/dune <==
(library
 (name vmax)
 (instrumentation (backend landmarks))
 (libraries ptime mustache fit utils expr yojson))

```

A `dune build` now builds

```auto
./_build/default/bin/main.exe
./_build/profiling/bin/main.exe

```

Observations so far:

- Running the profiling binary does not create a profiling log, no matter if `OCAML_LANDMARKS=output=landmarks.txt,time,allocation` is set or not. This suggests the setup above is missing something or the build step requires something that I am missing.
- `./_build/install`contains both binaries - but which one gets installed when doing a `dune install`?

I had Landmarks working when I used

```auto
(preprocess
   (pps landmarks-ppx --auto))

```

but this makes it difficult to switch between profiling and no profiling.

---

<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:** [April 14, 2026, 12:36pm UTC](https://discuss.ocaml.org/t/profiling-with-landmarks-setup-question/17983/2 "2026-04-14T12:36:43Z")

</div>

> [@lindig](#):
>
> `OCAML_LANDMARKS=output=landmarks.txt,time,allocation`

```auto
(lang dune 3.21)
(context default)
(context
  (default
    (name profiling)
    (instrument_with landmarks)
    (env
      (_ (env-vars ("OCAML_LANDMARKS" "auto")))
    )
  )
)

```

The environment variable must be set during compilation and execution.
