caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe Filliatre <filliatr@lri.fr>
To: Julien Michel <julien.michel@etu.univ-orleans.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Unix module troubles & Time functions
Date: Tue, 18 Jul 2006 13:59:42 +0200	[thread overview]
Message-ID: <17596.52526.904011.898429@pc9-152.lri.fr> (raw)
In-Reply-To: <20060718121035.hy7o1wa1cmhus4g0@webmailetu.univ-orleans.fr>


Julien Michel writes:
 > I would like to measure the time a function spends inside a Caml
 > program, for performance purpose.
 > I need a function with an accuracy of at least 1us.
 > [...]
 > Or generally speaking, does any other function exists to achieve such a
 > measurement (accuracy about 1 us) ?

To do such a measurement, I'm using the Unix.times function, as
follows:

======================================================================
open Unix
  
let utime f x =                                                   
  let u = (times()).tms_utime in                                  
  let y = f x in
  let ut = (times()).tms_utime -. u in
  (y,ut)

let print_utime f x = 
  let (y,ut) = utime f x in
  Printf.printf "user time: %2.2f\n" ut;
  y
======================================================================

Hope this helps,
-- 
Jean-Christophe Filliâtre (http://www.lri.fr/~filliatr)


  reply	other threads:[~2006-07-18 11:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18 10:10 Julien Michel
2006-07-18 11:59 ` Jean-Christophe Filliatre [this message]
2006-07-18 13:27   ` [Caml-list] " Julien Michel
2006-07-18 15:33 ` William D. Neumann
2006-07-19 10:03 Julien Michel

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=17596.52526.904011.898429@pc9-152.lri.fr \
    --to=filliatr@lri.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=julien.michel@etu.univ-orleans.fr \
    /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).