English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
[Caml-list] Profiling a function execution
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-25 (18:05)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Profiling a function execution
Just to complement Damien's answers:

> 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 ?

At least under Linux, getrusage() doesn't provide more accuracy than
times(), since the kernel maintains user and system time as an
integral number of clock ticks.  I haven't looked at other Unix
kernels, but I suspect that the additional precision made possible by
the getrusage() syscall is simply not exploited.  

(Besides, times() is part of the POSIX standard while getrusage() is not,
meaning less portability.)

> 4) Is it possible to know at runtime whether we are running native code 
> or interpreted bytecode ?

Some clever hacks involving external C functions were given on this list.
I'm not sure I would endorse them :-)  But your question begs another
question: why would you need to do distinguish native code from
bytecode?  We're working hard on removing the last discrepancies
between the two compilers...

- Xavier Leroy

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