package why3find

  1. Overview
  2. Docs

Module Why3findUtils.TimerSource

Time related features.

Timers

A timer is created with create, and can the be started with start. A running timer can be stopped with stop and the time of this run (the time elapsed since last start) is added to the timer. A new run can then be started with start

Sourcetype timer

The type of timers.

Sourceval create : unit -> timer

Return a new timer.

Sourceval start : timer -> unit

Start the timer.

Sourceval stop : timer -> unit

Stop the timer.

Sourceval count : timer -> int

Return the number of runs.

Sourceval min_time : timer -> float

Return the time of the shortest run.

Sourceval max_time : timer -> float

Return the time of the longest run.

Sourceval average_time : timer -> float

Return the average time of a run.

Sourceval total_time : timer -> float

Return the total time (the sum of the time of every run).

Sourceval create_global : string -> timer

Create and register a timer to be printed by print_timings. The string argument is the timer name.

Sourceval timed : name:string -> ('a -> 'b) -> 'a -> 'b

Return a timed version of the argument function : a global timer of name name will time the function execution.

Sourceval timed2 : name:string -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c

Same as timed for binary functions.

Sourceval timed3 : name:string -> ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> 'd

Same as timed for ternary functions.

Sourceval print_timings : Format.formatter -> unit

Print the global timers on the given formatter.

Throttles

Sourceval throttle : ?delay:float -> ('a -> unit) -> ?force:bool -> 'a -> unit

throttle ~delay:d f make succesive calls to f to only happen every ~delay seconds. The delayed function can be passed ~force:true to apply f immediately. Defaults to ~delay:0.1 which is 100ms.