Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 71 lines (57 sloc) 1.842 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
6fac5ce @Aqua-Ye [cleanup] ocamllib: typo on Opa
Aqua-Ye authored
4 This file is part of Opa.
fccc685 Initial open-source release
MLstate authored
5
6fac5ce @Aqua-Ye [cleanup] ocamllib: typo on Opa
Aqua-Ye authored
6 Opa is free software: you can redistribute it and/or modify it under the
fccc685 Initial open-source release
MLstate authored
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
6fac5ce @Aqua-Ye [cleanup] ocamllib: typo on Opa
Aqua-Ye authored
10 Opa is distributed in the hope that it will be useful, but WITHOUT ANY
fccc685 Initial open-source release
MLstate authored
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
6fac5ce @Aqua-Ye [cleanup] ocamllib: typo on Opa
Aqua-Ye authored
16 along with Opa. If not, see <http://www.gnu.org/licenses/>.
fccc685 Initial open-source release
MLstate authored
17 *)
18 (**
19 Manipulation of Chronometers.
20 @author Mathieu Barbin
21 *)
22
23 type t = {
24 start : unit -> unit;
25 (**
26 start the chrono, does nothing if it already runs
27 *)
28
29 restart : unit -> unit;
30 (**
31 resets the cumulated time of the chrono, and starts it
32 *)
33
34 stop : unit -> unit;
35 (**
36 stops the chrono, but keeps the cumulated time
37 *)
38
39 read : unit -> float;
40 (**
41 reads the cumulated time
42 *)
43
44 reset : unit -> unit;
45 (**
46 stops the chrono and reset the cumulated time
47 *)
48 }
49
50 val make : unit -> t
51 val start : t -> unit
52 val restart : t -> unit
53 val stop : t -> unit
54 val read : t -> float
55 val reset : t -> unit
56 val print : t -> string -> unit
57
58 (** {b Descr}: {b measure f g} Mesures the execution time of the
59 function {b f} and returns the application of the function {b g} on this
60 elapsed time amount. *)
61 val measure : (unit -> 'a) -> (float -> unit) -> 'a
62
63 (**
64 Measure the execution time of the given thunk
65 and display it on stderr, prefixed by the given string
66 *)
67 val measure_and_show : string -> (unit -> 'a) -> 'a
68
69 (** Bound the execution time of a function by a given number of seconds **)
70 val bound : int -> (unit -> 'a) -> (unit -> 'a) -> 'a
Something went wrong with that request. Please try again.