Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
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 Archives:
Bug reports: FAQ:
Beginner's list: