caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: gestion du temps en Caml ?
  1998-02-21  4:49 gestion du temps en Caml ? Berruyer
@ 1998-02-19 16:34 ` Pierre Weis
  1998-02-19 17:27   ` GillesDfnx
  1998-02-19 16:44 ` Patrick Loiseleur
  1 sibling, 1 reply; 4+ messages in thread
From: Pierre Weis @ 1998-02-19 16:34 UTC (permalink / raw)
  To: Berruyer; +Cc: caml-list

En Caml Light 0.74: la fonction sys__time : unit -> float donne le
temps e'coule' depuis le lancement du programme (ou du syste`me
interactif).
Sous Unix, vous pouvez aussi utiliser l'interface avec le syste`me
(module unix, fonction unix__time pour Caml Light et Unix.time pour
Objective Caml).

If you use Caml Light 0.74: the sys__time : unit -> float function
returns the elapsed time since the beginning of the execution.
Alternatively, under Unix, you may use the Unix module that provides
an interface to the operating system (unix__time for Caml Light, or
Unix.time for Objective Caml).

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/







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

* Re: gestion du temps en Caml ?
  1998-02-21  4:49 gestion du temps en Caml ? Berruyer
  1998-02-19 16:34 ` Pierre Weis
@ 1998-02-19 16:44 ` Patrick Loiseleur
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick Loiseleur @ 1998-02-19 16:44 UTC (permalink / raw)
  To: Berruyer; +Cc: caml-list

Il existe un outil, camlpro, qui vient avec caml-light 0.74 pour faire
exactement ce que vous désirez. Les détails sont dans la doc.

Cordialement

[English]
I think you can do what you want with the camlpro tool that comes with
the standard distribution






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

* Re: gestion du temps en Caml ?
  1998-02-19 16:34 ` Pierre Weis
@ 1998-02-19 17:27   ` GillesDfnx
  0 siblings, 0 replies; 4+ messages in thread
From: GillesDfnx @ 1998-02-19 17:27 UTC (permalink / raw)
  To: caml-light mailing list


Pour Objective caml et unix : il existe la fonction C clock (3), qui a
chaque appel retourne le temps ecoule depuis le dernier appel.

For Objective caml and unix : there exists a C function, clock (3),
that returns the elapsed time since last call.

(* Fichier clock.mli *)

external clock : unit -> int = "myclock"

/* Fichier clock.c */

#include <stdlib.h>
#include <time.h>
#include <mlvalues.h>

value myclock (unit)
        value unit;
{
  long i;
  i = clock() / CLOCKS_PER_SEC; /* Number of seconds */
  return Val_long (i);
}

(* Fichier test.ml *)

open Clock

let rec fibo = function
    0 -> 1
  | 1 -> 1
  | n -> fibo (n - 1) + fibo (n - 2);;

let _ =
  let _ = clock ()
  in let n = fibo 35
  in let time = clock ()
  in print_int time ; print_newline () ; n;;

(* Fin *)

$ make
ocamlc -c clock.mli
gcc -c -I/usr/lib/ocaml/caml clock.c
ocamlc -c test.ml
ocamlc -custom -o test unix.cma test.cmo clock.o -cclib -lunix
time -f "%e" ./test
14
14.46
$

-- 
                                                \\///
#use "std.disclaimer"                           (O O)
--------------------------------------------oOo--(_)--oOo--------
Gilles DEFOURNEAUX            \ /
Automated Deduction Team       |
ATINF project - LEIBNIZ lab  --|--
Grenoble, FRANCE               0    GillesDfnx@mail.dotcom.fr







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

* gestion du temps en Caml ?
@ 1998-02-21  4:49 Berruyer
  1998-02-19 16:34 ` Pierre Weis
  1998-02-19 16:44 ` Patrick Loiseleur
  0 siblings, 2 replies; 4+ messages in thread
From: Berruyer @ 1998-02-21  4:49 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

Bonjour,

Je travaille sur un projet de comparaison d'algorithmes, et pour cela,
je voudrais savoir s'il est possible en Caml-light de déterminer le
temps mis pour l'execution d'une fonction, par exemple en connaissant
la date du systeme au début et a la fin de l'execution.

Par avance,merci.

Benoit Berruyer.

I'm working on a project of comparison of algorithms, and I'd like to =
know
if there is a way to determine (through Caml-light) the time taken for
the execution of a function, for exemple by determining the date
before and after the execution.
Thanks.





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

end of thread, other threads:[~1998-02-20 10:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-21  4:49 gestion du temps en Caml ? Berruyer
1998-02-19 16:34 ` Pierre Weis
1998-02-19 17:27   ` GillesDfnx
1998-02-19 16:44 ` Patrick Loiseleur

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