caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: Denis Bueno <dbueno@gmail.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Tools for execution timing
Date: Tue, 27 Feb 2007 10:48:10 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0702271034140.11613@localhost> (raw)
In-Reply-To: <6dbd4d000702271024w1cabaec6u95aee737b411393e@mail.gmail.com>

On Tue, 27 Feb 2007, Denis Bueno wrote:

> Dear list,
>
> Just a general request (Caml Hump & Google didn't find anything,
> really): what do people use to time executions? I want to time the
> execution of various phases of a compiler I'm writing, in order to get
> an idea of how relatively efficient they are.
>
> Would you recommend I just roll my own? Or is there something written
> & debugged I could use?


You could use that:

let time msg f x =
  let t1 = Unix.gettimeofday () in
  let result = f x in
  let t2 = Unix.gettimeofday () in
  Printf.printf "%s: %.3f s\n%!" msg (t2 -. t1);
  result


--
Martin Jambon
http://martin.jambon.free.fr


  reply	other threads:[~2007-02-27 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 18:24 Denis Bueno
2007-02-27 18:48 ` Martin Jambon [this message]
2007-02-27 18:52 ` [Caml-list] " Daniel Bünzli
2007-02-27 19:05   ` Denis Bueno
2007-02-27 19:15 ` Sam Steingold
2007-02-28  1:27 ` [Caml-list] " Christian Stork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0702271034140.11613@localhost \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=dbueno@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).