module Oclock:sig
..end
This module gives access to the clock_gettime (2)
family of functions to
OCaml programs.
If this module allows programs to get time at 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
.
Author(s): Mickaƫl Delahaye
typeclockid =
int
val getres : clockid -> int64
val gettime : clockid -> int64
val settime : clockid -> int64 -> unit
Invalid_argument
if the clock identifier
is not supported, and a Failure
if the call fails for any other reason
(including permission problems).val realtime : clockid
val realtime_coarse : clockid
CLOCK_REALTIME_COARSE
(since 2.6.32)
or FreeBSD equivalent CLOCK_REALTIME_FAST
.
If not available, set to Oclock.realtime
.val monotonic : clockid
val monotonic_coarse : clockid
CLOCK_MONOTONIC_COARSE
(since 2.6.32)
or FreeBSD equivalent CLOCK_MONOTONIC_FAST
.
If not available, set to Oclock.monotonic
.val monotonic_raw : clockid
Oclock.monotonic
.val boottime : clockid
Oclock.monotonic
.val process_cputime : clockid option
val thread_cputime : clockid option
val 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 -> clockid
Thread.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).