caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Unix module troubles & Time functions
@ 2006-07-18 10:10 Julien Michel
  2006-07-18 11:59 ` [Caml-list] " Jean-Christophe Filliatre
  2006-07-18 15:33 ` William D. Neumann
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Michel @ 2006-07-18 10:10 UTC (permalink / raw)
  To: caml-list

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
target.

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
error:
Fatal error: cannot load shared library dllunix
Reason: /usr/local/lib/ocaml/stublibs/dllunix.so: cannot open shared object
file: No such file or directory

whereas, \"dllunix.so\" 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [Caml-list] Unix module troubles & Time functions
@ 2006-07-19 10:03 Julien Michel
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Michel @ 2006-07-19 10:03 UTC (permalink / raw)
  To: caml-list

Thanks a lot William, I am sure it will the best way for having acces to
the Unix Gettimeofday function.
Nevertheless, I used exactly the same code as you gave me below.

While compiling:
ocamlc -c timer.c
no error !
then compiling:
ocamlc -o timer timer.o timer.ml
I get this error:
"Error while linking timer.cmo:
The external function `my_gettimeofday' is not available"

so I tried:
ocamlc -custom -o timer timer.o timer.ml
no error during compilation
but while executing the generated bytecode, wether it is on the development
plateform, or on the embedded target, I get this error:
Fatal error: unknown C primitive `my_gettimeofday'

I am afraid to have came back to the beggining of my problem, with
unixdup...
I do not understand what is going on.
Everthing seems to be ok from the Ocaml side, but there is something wrong
from Unix/system side.

Is there a way so that the runtime system "ocamlrun" can recognize
"my_gettimeofday"?

Do I have to keep the wole content of the original timer.c file, and only
include my_gettimeofday function?


Cheers

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-19 10:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-18 10:10 Unix module troubles & Time functions Julien Michel
2006-07-18 11:59 ` [Caml-list] " Jean-Christophe Filliatre
2006-07-18 13:27   ` Julien Michel
2006-07-18 15:33 ` William D. Neumann
2006-07-19 10:03 Julien Michel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).