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
Unix module troubles & Time functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-07-18 (10:12)
From: Julien Michel <julien.michel@e...>
Subject: Unix module troubles & Time functions
Hi all,
I would like to measure the time a function spends inside a Caml program, for
performance purpose.
I need a function with an accuracy of at least 1us.
I usually use \"gettimeofday\" to achieve this kind of measures with Unix.

So I would like to use the Unix.gettimeofday() function which I expect to have
the same accuracy than the unix one.

I work on an embedded system and I had to specially compile ocamlrun for this

I first tried to compile the sources from my developpement plateform this way:
ocamlc -o main unix.cma *.ml...

then I executed the generated byecode on my embedded target ad got the following
Fatal error: cannot load shared library dllunix
Reason: /usr/local/lib/ocaml/stublibs/ cannot open shared object
file: No such file or directory

whereas, \"\" exists well and the path to raise it is good too!

if I try to compile this way:
ocamlc -o main -cclib -lunix unix.cma *ml
I get the same error as in the message above.

and trying to compile this way:
ocamlc -custom -o main unix.cma *ml
returns this error while executing on my target:
Fatal error: unknown C primitive `unix_dup\'

What can be wrong with my system so that I cannot use the Unix.module?
The Gettimeofday unix function usually works well on my target, is there another
way for having access to it with Caml?

Or generally speaking, does any other function exists to achieve such a
measurement (accuracy about 1 us) ?

Thanks to all

This message was sent using IMP, the Internet Messaging Program.