module Oclock:Oclock: precise POSIX clock for OCamlsig..end
This module give access to the clock_gettime (2) family of functions to
Ocaml programs.
If this module allows to access time of real- or CPU-time clocks in
nanoseconds, the actual precision of the clocks might be much coarser.
Also, the resolution of a clock, Oclock.getres should indicate the period of the
timer used for this clock, but the actual precision of the clock greatly
depends on the CPU (watch out for frequency scaling!) and its time source.
You can estimate the precision available on your platform with the shipped
example examples/realtime.
typeclockid =int
val getres : clockid -> int64val gettime : clockid -> int64val settime : clockid -> int64 -> unitInvalid_argument if the clock identifier
is not supported, and a Failure if the call fails for any ohter reason
(including permission problems).val realtime : clockidval monotonic : clockidval process_cputime : clockidval thread_cputime : clockidval monotonic_raw : clockidval getcpuclockid : int -> clockid
Raises an Invalid_argument exception if the provided integer is not a valid
PID, and a Failure if the calls fails for any other reason (including
permission problems).
val pthread_getcpuclockid : int -> clockidThread.id (but only if you use real POSIX threads -thread
and not VM threads -vmthread).
Raises an Invalid_argument exception if the provided integer is not a valid
thread identifier, and a Failure if the calls fails for any other reason
(including permission problems).