<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/9f922a27f598ae82ac0f62db2c953605"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-13T22:53:58"
  subject="Re: [Caml-list] Profiling a function execution"
  prev="2003/11/34f26b24813463c04244b74a889dc2a3"
  next="2003/11/e9e72661772b71fc00ec1280a727a273"
  prev-in-thread="2003/11/34f26b24813463c04244b74a889dc2a3"
  next-in-thread="2003/11/ccaf83034bb4211c2c282eaf9cc29131"
  prev-thread="2003/11/3f569e7c0ae6343b3f1d7e892dcba645"
  next-thread="2003/11/659715962834b450cc1e0aeddeb9dc7e"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Profiling a function execution">
<msg 
  url="2003/11/34f26b24813463c04244b74a889dc2a3"
  from="Daniel_Bünzli &lt;daniel.buenzli@e...&gt;"
  author="Daniel_Bünzli"
  date="2003-11-13T22:34:14"
  subject="[Caml-list] Profiling a function execution">
<msg 
  url="2003/11/9f922a27f598ae82ac0f62db2c953605"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-13T22:53:58"
  subject="Re: [Caml-list] Profiling a function execution">
<msg 
  url="2003/11/ccaf83034bb4211c2c282eaf9cc29131"
  from="Ville-Pertti Keinonen &lt;will@e...&gt;"
  author="Ville-Pertti Keinonen"
  date="2003-11-14T12:23:53"
  subject="Re: [Caml-list] Profiling a function execution">
</msg>
<msg 
  url="2003/11/188916524dd342aefc88d89218040ae7"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-14T12:34:04"
  subject="Re: [Caml-list] Profiling a function execution">
<msg 
  url="2003/11/517bc908d9c80ef3b698d7c821a8317a"
  from="Wolfgang Lux &lt;wlux@u...&gt;"
  author="Wolfgang Lux"
  date="2003-11-15T11:11:19"
  subject="Re: [Caml-list] Profiling a function execution">
<msg 
  url="2003/11/f561faa2124a980042c1f6b2ea4c38a4"
  from="David MENTRE &lt;dmentre@l...&gt;"
  author="David MENTRE"
  date="2003-11-15T12:21:34"
  subject="Re: [Caml-list] Profiling a function execution">
</msg>
<msg 
  url="2003/11/4ad33fa3b94199e611c2eaf3954d0041"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-15T12:54:11"
  subject="Re: [Caml-list] Profiling a function execution">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/11/6f41f08fba60b932f48b1673055f188d"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-11-25T18:05:56"
  subject="Re: [Caml-list] Profiling a function execution">
<msg 
  url="2003/11/3926d9185cb59338ebbe489e8e1ae367"
  from="Daniel_Bünzli &lt;daniel.buenzli@e...&gt;"
  author="Daniel_Bünzli"
  date="2003-11-25T21:54:42"
  subject="Re: [Caml-list] Profiling a function execution">
</msg>
<msg 
  url="2003/11/099ebe67b9b5a5241762a30b9a733ffb"
  from="Kim Nguyen &lt;nguyen@b...&gt;"
  author="Kim Nguyen"
  date="2003-11-25T22:36:27"
  subject="Re: [Caml-list] Profiling a function execution">
</msg>
<msg 
  url="2003/11/615473df5cbf28e2eb2ecd0c2052564a"
  from="Ville-Pertti Keinonen &lt;will@e...&gt;"
  author="Ville-Pertti Keinonen"
  date="2003-11-26T12:23:29"
  subject="Re: [Caml-list] Profiling a function execution">
</msg>
</msg>
</msg>
</thread>

<contents>
On Thu, 13 Nov 2003, Daniel Bünzli wrote:

&gt; 2) Unix.times seems to have a low resolution, which means that my 
&gt; timings are often 0.0 (unless I execute the function a lot of times). I 
&gt; don't want to use Unix.gettimeofday because this prevents me to make 
&gt; the difference between user and system time. Has anybody bindings to 
&gt; 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

</contents>

</message>

