From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA02259; Thu, 13 Nov 2003 23:53:58 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA02658 for ; Thu, 13 Nov 2003 23:53:57 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hADMrt127815 for ; Thu, 13 Nov 2003 23:53:56 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hADMrpC09111; Thu, 13 Nov 2003 16:53:51 -0600 (CST) Date: Thu, 13 Nov 2003 17:53:01 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: =?ISO-8859-1?Q?Daniel_B=FCnzli?= cc: Ocaml Mailing List Subject: Re: [Caml-list] Profiling a function execution In-Reply-To: <81F621FD-1629-11D8-A1E1-000393DBC266@epfl.ch> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 timings:01 0.0:01 gettimeofday:01 milliseconds:01 milliseconds:01 bindings:01 nov:01 unix:02 unix:02 wrote:03 anybody:03 redirect:95 execute:04 seems:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 13 Nov 2003, Daniel Bünzli wrote: > 2) Unix.times seems to have a low resolution, which means that my > timings are often 0.0 (unless I execute the function a lot of times). I > don't want to use Unix.gettimeofday because this prevents me to make > the difference between user and system time. Has anybody bindings to > the getrusage function or another idea ? Clocks on computers have a 10ms quantiziation- i.e., they measure everything as multiples of 10 milliseconds. All measurements are accurate only up to about +/- 10 milliseconds. I.e. if times reports that something takes 50 milliseconds, it probably takes more than 40 but less than 60 milliseconds. My recommendation if you want to time something that takes less than seconds to do, is to do it lots of times. You want the amount of time between two calls to times to be at least seconds, if not tens of seconds or minutes. You then divide the total amount of time taken by the number of times the operation was executed, to get the time per execution. Is there a wrapper to the clock function kicking around? -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners