From : Mark Shinwell <mark AT three-tuns.net>

: Mark Shinwell <mark AT three-tuns.net> To : caml-list AT yquem.inria.fr

: caml-list AT yquem.inria.fr Subject : [Caml-list] enhancements for "perf" on OCaml code

: [Caml-list] enhancements for "perf" on OCaml code Date: Fri, 12 Jul 2013 14:46:50 +0100

Linux has a tool called "perf" that enables the display of source codealongside time profiling information and the corresponding assembly code.(See https://perf.wiki.kernel.org/index.php/Tutorial , "perf annotate").I am pleased to announce an alpha version of the OCaml native code compilerthat permits perf to do the same for OCaml code. This compiler works only onx86-64 Linux, although porting it to other Linux targets should bestraightforward.The compiler is available in OPAM. If you add the remote repositorygit://github.com/mshinwell/opam-repo-dev then you should be able to"opam switch" to the 4.01-perf-annotate compiler. Please let me have anyreports of problems.After compilation, you can run "perf record" to gather data about yourOCaml program, and then use "perf report" to interactively examine it.If you hit Return on a function, then you should be given the option toannotate it, and then you should see the OCaml code as above. Note thatline number information is not yet as fine-grained for OCaml as it mightbe for C code.You need to have the source files available at the same location on thefilesystem when you run "perf report" as you did when you compiled theprogram.This work forms part of a larger project in collaboration with OCaml Labsat Cambridge, UK, to enhance the level of debugging information emittedby the OCaml compiler. The perf-annotate compiler emits debugging sectionsthat aim to be compliant with the DWARF-2 standard.MarkP.S. The eagle-eyed of you will notice that there is another compiler,4.01-allocation-profiling, also available in that OPAM repo. This providesallocation profiling capabilities for native code, documentation for which Iwill endeavour to circulate to the list shortly.