caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Tools for execution timing
@ 2007-02-27 18:24 Denis Bueno
  2007-02-27 18:48 ` [Caml-list] " Martin Jambon
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Denis Bueno @ 2007-02-27 18:24 UTC (permalink / raw)
  To: OCaml Mailing List

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?

Thanks in advance.

-Denis


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

* Re: [Caml-list] Tools for execution timing
  2007-02-27 18:24 Tools for execution timing Denis Bueno
@ 2007-02-27 18:48 ` Martin Jambon
  2007-02-27 18:52 ` Daniel Bünzli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Martin Jambon @ 2007-02-27 18:48 UTC (permalink / raw)
  To: Denis Bueno; +Cc: OCaml Mailing List

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


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

* Re: [Caml-list] Tools for execution timing
  2007-02-27 18:24 Tools for execution timing Denis Bueno
  2007-02-27 18:48 ` [Caml-list] " Martin Jambon
@ 2007-02-27 18:52 ` 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
  3 siblings, 1 reply; 6+ messages in thread
From: Daniel Bünzli @ 2007-02-27 18:52 UTC (permalink / raw)
  To: Denis Bueno; +Cc: OCaml Mailing List


Le 27 févr. 07 à 19:24, Denis Bueno a écrit :

> what do people use to time executions?

Assuming you are not on windows. Compile with -p and use gprof  
(linux) or shark (macos). If you want to time within the program  
itself there is Unix.times and Gc.stat to respectively track time and  
memory usage.

Best,

Daniel





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

* Re: [Caml-list] Tools for execution timing
  2007-02-27 18:52 ` Daniel Bünzli
@ 2007-02-27 19:05   ` Denis Bueno
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Bueno @ 2007-02-27 19:05 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: OCaml Mailing List

On 2/27/07, Daniel Bünzli <daniel.buenzli@epfl.ch> wrote:
>
> Le 27 févr. 07 à 19:24, Denis Bueno a écrit :
>
> > what do people use to time executions?
>
> Assuming you are not on windows. Compile with -p and use gprof
> (linux) or shark (macos). If you want to time within the program

Ah! Didn't think about using Shark. I tried that just now and it works
like a charm. Thanks for the advice!

-Denis


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

* Re: Tools for execution timing
  2007-02-27 18:24 Tools for execution timing Denis Bueno
  2007-02-27 18:48 ` [Caml-list] " Martin Jambon
  2007-02-27 18:52 ` Daniel Bünzli
@ 2007-02-27 19:15 ` Sam Steingold
  2007-02-28  1:27 ` [Caml-list] " Christian Stork
  3 siblings, 0 replies; 6+ messages in thread
From: Sam Steingold @ 2007-02-27 19:15 UTC (permalink / raw)
  To: Denis Bueno; +Cc: OCaml Mailing List

Denis Bueno wrote:
> Would you recommend I just roll my own? Or is there something written
> & debugged I could use?

http://sds.podval.org/data/space.ml
comments welcome



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

* Re: [Caml-list] Tools for execution timing
  2007-02-27 18:24 Tools for execution timing Denis Bueno
                   ` (2 preceding siblings ...)
  2007-02-27 19:15 ` Sam Steingold
@ 2007-02-28  1:27 ` Christian Stork
  3 siblings, 0 replies; 6+ messages in thread
From: Christian Stork @ 2007-02-28  1:27 UTC (permalink / raw)
  To: OCaml Mailing List

On Tue, Feb 27, 2007 at 01:24:50PM -0500, 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?

As part of CIL there's the Stats module which allows very accurate
timings especially on Intel x86 from Pention on upward:

http://hal.cs.berkeley.edu/cil/api/Stats.html

-- 
Chris Stork   <>  Support eff.org!  <>   http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F


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

end of thread, other threads:[~2007-02-28  1:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 18:24 Tools for execution timing Denis Bueno
2007-02-27 18:48 ` [Caml-list] " Martin Jambon
2007-02-27 18:52 ` 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

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).