Instrumentation?

I’m curious about a way for instrumentation of OCaml code. By instrumentation, I mean taking a complete or partial log of an ocaml code which shows when, what function (or a piece of code) is called with what arguments and global/local variables. It is different from profiling, because it tries to get a complete history rather than a summary of calls.

For example, in Java world, AspectJ enables instrumentation using aspect-oriented programming. (But I don’t mean aspect-oriented programming in general but just logging)

So you want to generate a complete execution trace of all function calls?

Yes, or target some specific function calls (with certain conditions)

This is sometimes done in other languages with debuggers, often by inserting breakpoints and scripting what is done in response.

1 Like

Pretty sure that the mechanism behind bisect_ppx could be repurposed for this kind of tracing. The only issue with such an approach is the runtime performance penalty it incurs.

2 Likes