Tools for profiling OCaml code

2019-04-04 02:03发布

Is anybody aware of programs for profiling OCaml code apart from using the -p option while compilation and then using gprof? I am asking this question in order to check if the sampling time of 0.01 second can be lowered further?

4条回答
该账号已被封号
2楼-- · 2019-04-04 02:33

Never used it but ocamlviz is another option.

查看更多
孤傲高冷的网名
3楼-- · 2019-04-04 02:48

poorman's profiler is perfectly applicable for OCaml programs. The same idea works out for profiling allocations as well.

查看更多
▲ chillily
4楼-- · 2019-04-04 02:49

Adding to the list of useful answers: this OCamlPro post mentions performance profiling (not memory profiling) of native code on Linux using perf (installed via package linux-tools in Debian-like distributions).

Basically, you just need to run:

perf record -g ./native_program arguments

To produce a perf.data file containing profiling data, and then run

perf report -g

To see the results.

It works better when using an OCaml release with frame pointers enabled (e.g. 4.02.1+fp instead of 4.02.1 on OPAM).

查看更多
爷、活的狠高调
5楼-- · 2019-04-04 02:54

You can also use ocaml-memprof, a compiler patch (3.12.0 and 3.12 1) written by Fabrice Le Fessant, that adds memory profiling features to ocaml programs.

EDIT

Now you have ocp-memprof, an OCaml Memory Profiler that you can use online. It is available on http://memprof.typerex.org.

查看更多
登录 后发表回答