From d07319f790eb38c867bd04a23de674e2393825ff Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Sun, 22 Mar 2015 20:20:28 +0100 Subject: Better support for poor os monotonic sources --- erts/doc/src/erlang.xml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 3cbfd372ce..98c0ef5f81 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -6449,6 +6449,15 @@ ok precision won't be higher than OsMonotonicTimeResolution.

+ {extended, Extended} +

Extended equals yes if + the range of time values has been extended; + otherwise, Extended equals no. The + range needs to be extended if Function + returns values that wrap fast. This typically + is the case when the return value is a 32-bit + value.

+ {parallel, Parallel}

Parallel equals yes if Function is called in parallel from multiple -- cgit v1.2.3 From 052695858c07477db480d25d2d858540088d04c3 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 24 Mar 2015 10:27:20 +0100 Subject: Documentation adjustments --- erts/doc/src/erlang.xml | 33 ++++++++++++++++++++++----------- erts/doc/src/time_correction.xml | 29 +++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 13 deletions(-) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 98c0ef5f81..7cb417ac92 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -110,10 +110,17 @@

The value of the native time unit gives you more or less no information at all about the - quality of time values. It sets an upper bound for - the resolution as well as for the precision, but it - gives absolutely no information at all about the - accuracy.

+ quality of time values. It sets a limit for + the + resolution + as well as for the + precision + of time values, + but it gives absolutely no information at all about the + accuracy + of time values. The resolution of the native time + unit and the resolution of time values may differ + significantly.

@@ -6435,18 +6442,22 @@ ok Function.

{resolution, OsMonotonicTimeResolution} -

Highest possible resolution of current - OS monotonic time source as parts per second. If - no resolution information can be retreived from - the OS, OsMonotonicTimeResolution will be +

Highest possible + resolution + of current OS monotonic time source as parts per + second. If no resolution information can be retreived + from the OS, OsMonotonicTimeResolution will be set to the resolution of the time unit of Functions return value. That is, the actual resolution may be lower than OsMonotonicTimeResolution. 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 higher than + accuracy, + and that the + precision + might not align with the resolution. You do, + however, know that the precision won't be + better than OsMonotonicTimeResolution.

{extended, Extended} diff --git a/erts/doc/src/time_correction.xml b/erts/doc/src/time_correction.xml index 3bc3d04186..ed658ff58c 100644 --- a/erts/doc/src/time_correction.xml +++ b/erts/doc/src/time_correction.xml @@ -114,6 +114,29 @@ happened yet), POSIX time would make a one second leap forward.

+ +
+ Time Resolution +

The shortest time interval that can be distinguished when + reading time values.

+
+ + +
+ Time Precision +

The shortest time interval that can be be distinguished + repeatedly and reliably when reading time values. Precision + is limited by the + resolution, but + resolution and precision might differ significantly.

+
+ + +
+ Time Accuracy +

The correctness of time values.

+
+
OS System Time @@ -162,8 +185,10 @@ Erlang runtime system. The Erlang monotonic time increase since some unspecified point in time. It can be retrieved by calling erlang:monotonic_time(). - The accuracy, and precision of Erlang monotonic time heavily - depends on the accuracy and precision of + The + accuracy, and + precision of Erlang + monotonic time heavily depends on the accuracy and precision of OS monotonic time, the accuracy and precision of OS system time as well -- cgit v1.2.3 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