I’ve used Landmarks in the past, mostly because it was really easy to setup and instrument a run.
With the new OCaml tracing tools, I wonder what would be the simplest way to have something similar, that is: just a simple bar graph or something showing which functions take the longest time during execution.
Is this usage scenario appropriate for tracing tools? And between opentelemetry, tracy, chrome traces, etc, which would be the simplest to adapt?
Landmarks has the advantage of being “pure OCaml”, so it only reports OCaml-level functions, which is much more useful for some quick and simple profiling.
The trace mechanism seems like it might give the same “high-level” information.
I’ll admit I tend to reach for perf + flamegraph for this kind of high level view, otherwise I instrument with trace and look at what the program does in perfetto. It depends a bit on the shape of the program though.
Is there something equivalent to Landmarks’ automatic instrumentation? From my very quick glance at the documentation, even with trace_ppx, I need to add %trace to the let constructions that I wish to trace, is that it? For now I’d like some basic “function call instrumentation” as automatic as possible, and then later likely add some specific spans for more details.
Overall, my profiling needs are very basic and rare; so if it’s “almost free”, I end up doing it from time to time, but otherwise I just end up forgetting about it.
@nojb: I’m asking about an alternative to Landmarks mainly for the result visualization part. Maybe it’s already in Landmarks and I missed it, but currently I only have its text output in the terminal, or the landmarks-viewer in the browser; but I assume that with Chrome traces or some other format, I might be able to use other tools such as Perfetto.
There isn’t automatic instrumentation yet (I suppose the ppx could do it, modulo the actual implementation work!). I think landmarks, too, could in theory be implemented in terms of trace (it also has enter/exit events after all).
I wonder if the landmarks format is documented? It’s described as simple, so maybe I could do a trace backend that emits it (at least for the biggest features).