caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] enhancements for "perf" on OCaml code
@ 2013-07-12 13:46 Mark Shinwell
  2013-07-12 14:35 ` Maxime Dénès
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Shinwell @ 2013-07-12 13:46 UTC (permalink / raw)
  To: caml-list

Linux has a tool called "perf" that enables the display of source code
alongside 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 compiler
that permits perf to do the same for OCaml code.  This compiler works only on
x86-64 Linux, although porting it to other Linux targets should be
straightforward.

The compiler is available in OPAM.  If you add the remote repository
git://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 any
reports of problems.

After compilation, you can run "perf record" to gather data about your
OCaml program, and then use "perf report" to interactively examine it.
If you hit Return on a function, then you should be given the option to
annotate it, and then you should see the OCaml code as above.  Note that
line number information is not yet as fine-grained for OCaml as it might
be for C code.

You need to have the source files available at the same location on the
filesystem when you run "perf report" as you did when you compiled the
program.

This work forms part of a larger project in collaboration with OCaml Labs
at Cambridge, UK, to enhance the level of debugging information emitted
by the OCaml compiler.  The perf-annotate compiler emits debugging sections
that aim to be compliant with the DWARF-2 standard.

Mark

P.S. The eagle-eyed of you will notice that there is another compiler,
4.01-allocation-profiling, also available in that OPAM repo.  This provides
allocation profiling capabilities for native code, documentation for which I
will endeavour to circulate to the list shortly.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] enhancements for "perf" on OCaml code
  2013-07-12 13:46 [Caml-list] enhancements for "perf" on OCaml code Mark Shinwell
@ 2013-07-12 14:35 ` Maxime Dénès
  2013-07-12 15:41   ` Mark Shinwell
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Dénès @ 2013-07-12 14:35 UTC (permalink / raw)
  To: caml-list

Hello,

Is it related to the recently introduced "-with-frame-pointers" 
configure flag http://caml.inria.fr/mantis/view.php?id=5721 ?

The purpose of this flag seemed to be the use of the same perf tool.

Maxime.

On 12/07/2013 15:46, Mark Shinwell wrote:
> Linux has a tool called "perf" that enables the display of source code
> alongside 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 compiler
> that permits perf to do the same for OCaml code.  This compiler works only on
> x86-64 Linux, although porting it to other Linux targets should be
> straightforward.
>
> The compiler is available in OPAM.  If you add the remote repository
> git://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 any
> reports of problems.
>
> After compilation, you can run "perf record" to gather data about your
> OCaml program, and then use "perf report" to interactively examine it.
> If you hit Return on a function, then you should be given the option to
> annotate it, and then you should see the OCaml code as above.  Note that
> line number information is not yet as fine-grained for OCaml as it might
> be for C code.
>
> You need to have the source files available at the same location on the
> filesystem when you run "perf report" as you did when you compiled the
> program.
>
> This work forms part of a larger project in collaboration with OCaml Labs
> at Cambridge, UK, to enhance the level of debugging information emitted
> by the OCaml compiler.  The perf-annotate compiler emits debugging sections
> that aim to be compliant with the DWARF-2 standard.
>
> Mark
>
> P.S. The eagle-eyed of you will notice that there is another compiler,
> 4.01-allocation-profiling, also available in that OPAM repo.  This provides
> allocation profiling capabilities for native code, documentation for which I
> will endeavour to circulate to the list shortly.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] enhancements for "perf" on OCaml code
  2013-07-12 14:35 ` Maxime Dénès
@ 2013-07-12 15:41   ` Mark Shinwell
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Shinwell @ 2013-07-12 15:41 UTC (permalink / raw)
  To: Maxime Dénès; +Cc: caml-list

On 12 July 2013 15:35, Maxime Dénès <Maxime.Denes@inria.fr> wrote:
> Is it related to the recently introduced "-with-frame-pointers" configure
> flag http://caml.inria.fr/mantis/view.php?id=5721 ?
>
> The purpose of this flag seemed to be the use of the same perf tool.

Compilation with a frame pointer enables the display of callgraph
information in perf.  It is effectively a workaround for the fact that the
in-kernel stack unwinder used by perf does not use the debugging
information in the executable.

The perf-annotate compiler is designed specifically to make the
"perf annotate" feature of the perf tools work in a satisfactory way
for OCaml code.  It's roughly speaking orthogonal, but you probably
want to use both.

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-12 15:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 13:46 [Caml-list] enhancements for "perf" on OCaml code Mark Shinwell
2013-07-12 14:35 ` Maxime Dénès
2013-07-12 15:41   ` Mark Shinwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).