From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9D330BC6C for ; Tue, 27 Feb 2007 19:49:21 +0100 (CET) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1RInKfb013009 for ; Tue, 27 Feb 2007 19:49:21 +0100 Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 7385A1EAF86; Tue, 27 Feb 2007 13:49:18 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by out1.internal (MEProxy); Tue, 27 Feb 2007 13:49:18 -0500 X-Sasl-enc: ELHARFwNCiOegmGtaaOOMdlP1xK+V+rsZyx3ElpGlyWk 1172602158 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by mail.messagingengine.com (Postfix) with ESMTP id CB7AD1DE21; Tue, 27 Feb 2007 13:49:17 -0500 (EST) Date: Tue, 27 Feb 2007 10:48:10 -0800 (PST) From: Martin Jambon X-X-Sender: martin@localhost To: Denis Bueno Cc: OCaml Mailing List Subject: Re: [Caml-list] Tools for execution timing In-Reply-To: <6dbd4d000702271024w1cabaec6u95aee737b411393e@mail.gmail.com> Message-ID: References: <6dbd4d000702271024w1cabaec6u95aee737b411393e@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 45E47D30.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 compiler:01 gettimeofday:01 gettimeofday:01 printf:01 printf:01 2007,:98 unix:01 unix:01 wrote:01 caml-list:01 jambon:01 jambon:01 caml:02 hump:02 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