From c20482023b70768bd84d25f1e34dbbc2fe09cf31 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 24 Mar 2015 15:28:11 +0100 Subject: Better OS system time implementation --- erts/doc/src/erlang.xml | 55 ++++++++++++++++++++++++++++++++++++++++ erts/doc/src/time_correction.xml | 14 +++++++--- 2 files changed, 65 insertions(+), 4 deletions(-) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 7cb417ac92..bd5efb712c 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -6031,6 +6031,8 @@ ok + + Information about the system

Returns various information about the current system @@ -6482,6 +6484,59 @@ ok time unit.

+ os_system_time_source + +

Returns a list containing information about the source of + OS + system time that is used by the runtime system.

+

The list contains two-tuples with Keys + as first element, and Values as second element. The + order if these tuples is undefined. Currently the following + tuples may be part of the list, but more tuples may be + introduced in the future:

+ + {function, Function} +

Function is the name of the funcion + used.

+ + {clock_id, ClockId} +

This tuple only exist if Function + can be used with different clocks. ClockId + corresponds to the clock identifer used when calling + Function.

+ + {resolution, OsSystemTimeResolution} +

Highest possible + resolution + of current OS system time source as parts per + second. If no resolution information can be retreived + from the OS, OsSystemTimeResolution will be + set to the resolution of the time unit of + Functions return value. That is, the actual + resolution may be lower than + OsSystemTimeResolution. Also note that + the resolution does not say anything about the + accuracy, + and that the + precision + might not align with the resolution. You do, + however, know that the precision won't be + better than + OsSystemTimeResolution.

+ + {parallel, Parallel} +

Parallel equals yes if + Function is called in parallel from multiple + threads. If it is not called in parallel, because + calls needs to be serialized, Parallel equals + no.

+ + {time, OsSystemTime} +

OsSystemTime equals current OS + system time in native + time unit.

+
+
port_parallelism

Returns the default port parallelism scheduling hint used. For more information see the diff --git a/erts/doc/src/time_correction.xml b/erts/doc/src/time_correction.xml index ed658ff58c..979a37d7ff 100644 --- a/erts/doc/src/time_correction.xml +++ b/erts/doc/src/time_correction.xml @@ -147,7 +147,9 @@ This may or may not be an accurate view of POSIX time. This time may typically be adjusted both backwards and forwards without limitation. That is, huge leaps both backwards and forwards in time - may be observed.

+ may be observed. You can get information about the Erlang runtime + system's source of OS system time by calling + erlang:system_info(os_system_time_source).

@@ -161,7 +163,9 @@ point in time that is not connected to OS system time. Note that this type of time is not necessarily provided by all operating - systems.

+ systems. You can get information about the Erlang runtime + system's source of OS monotonic time by calling + erlang:system_info(os_monotonic_time_source).

@@ -597,6 +601,7 @@

erlang:monitor(time_offset, clock_service)

erlang:system_flag(time_offset, finalize)

erlang:system_info(os_monotonic_time_source)

+

erlang:system_info(os_system_time_source)

erlang:system_info(time_offset)

erlang:system_info(time_warp_mode)

erlang:system_info(time_correction)

@@ -852,8 +857,9 @@ EventTag = {Time, UMI} when it is not available. Fortunately almost all of the new API can easily be implemented using existing primitives (except for - erlang:system_info(start_time), and - erlang:system_info(os_monotonic_time_source)). + erlang:system_info(start_time), + erlang:system_info(os_monotonic_time_source), and + erlang:system_info(os_system_time_source)). By wrapping the API with functions that fall back on erlang:now/0 when the new API is not available, and using these wrappers instead of using the API directly -- cgit v1.2.3