I’m trying to set up a dune project for profiling with 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:
==> 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
./_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,allocationis set or not. This suggests the setup above is missing something or the build step requires something that I am missing. ./_build/installcontains both binaries - but which one gets installed when doing adune install?
I had Landmarks working when I used
(preprocess
(pps landmarks-ppx --auto))
but this makes it difficult to switch between profiling and no profiling.