From 18f0707c218ebdeb6024ecffd7704d3582e0b91c Mon Sep 17 00:00:00 2001
From: Rickard Green
Date: Tue, 2 Feb 2016 16:20:19 +0100
Subject: Use nano second time unit in tracing
---
erts/doc/src/erl_driver.xml | 5 +++--
erts/doc/src/erlang.xml | 9 +++++----
erts/emulator/beam/erl_trace.c | 3 ++-
erts/emulator/test/trace_bif_SUITE.erl | 4 ++--
4 files changed, 12 insertions(+), 9 deletions(-)
(limited to 'erts')
diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml
index e338e95938..34dc8af238 100644
--- a/erts/doc/src/erl_driver.xml
+++ b/erts/doc/src/erl_driver.xml
@@ -1052,8 +1052,9 @@ typedef struct ErlIOVec {
This function is deprecated! Do not use it!
- Use the documented
- time measurement functionality
+ Use erl_drv_monotonic_time()
+ (perhaps in combination with
+ erl_drv_time_offset())
instead.
This function reads a timestamp into the memory pointed to by
the parameter now. See the description of ErlDrvNowData for
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 79d3f66ea8..c9eb838230 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -7744,7 +7744,8 @@ ok
Timestamps in profile messages will use
Erlang
monotonic time. The time-stamp (Ts) has the same
- format and value as produced by erlang:monotonic_time().
+ format and value as produced by
+ erlang:monotonic_time(nano_seconds).
runnable_procs
-
@@ -7772,7 +7773,7 @@ ok
Erlang
monotonic time and a monotonically increasing
integer. The time-stamp (Ts) has the same format and value
- as produced by {erlang:monotonic_time(),
+ as produced by {erlang:monotonic_time(nano_seconds),
erlang:unique_integer([monotonic])}.
timestamp
@@ -8161,7 +8162,7 @@ timestamp() ->
Erlang
monotonic time time-stamp in all trace messages. The
time-stamp (Ts) has the same format and value as produced by
- erlang:monotonic_time(). This flag overrides
+ erlang:monotonic_time(nano_seconds). This flag overrides
the cpu_timestamp flag.
strict_monotonic_timestamp
@@ -8171,7 +8172,7 @@ timestamp() ->
monotonic time and a monotonically increasing
integer in all trace messages. The time-stamp (Ts) has the
same format and value as produced by
- {erlang:monotonic_time(),
+ {erlang:monotonic_time(nano_seconds),
erlang:unique_integer([monotonic])}. This flag overrides
the cpu_timestamp flag.
diff --git a/erts/emulator/beam/erl_trace.c b/erts/emulator/beam/erl_trace.c
index 2243639099..8a4c0ab1f2 100644
--- a/erts/emulator/beam/erl_trace.c
+++ b/erts/emulator/beam/erl_trace.c
@@ -165,7 +165,8 @@ take_timestamp(ErtsTraceTimeStamp *tsp, int ts_type)
case ERTS_TRACE_FLG_STRICT_MONOTONIC_TIMESTAMP: {
Uint hsz = 0;
ErtsMonotonicTime mtime = erts_get_monotonic_time(NULL);
- mtime += ERTS_MONOTONIC_OFFSET_NATIVE;
+ mtime = ERTS_MONOTONIC_TO_NSEC(mtime);
+ mtime += ERTS_MONOTONIC_OFFSET_NSEC;
hsz = (IS_SSMALL(mtime) ?
(Uint) 0
: ERTS_SINT64_HEAP_SIZE((Sint64) mtime));
diff --git a/erts/emulator/test/trace_bif_SUITE.erl b/erts/emulator/test/trace_bif_SUITE.erl
index 760666d077..96b7dd159f 100644
--- a/erts/emulator/test/trace_bif_SUITE.erl
+++ b/erts/emulator/test/trace_bif_SUITE.erl
@@ -314,9 +314,9 @@ receive_trace_msg_ts_return_to({trace_ts, Pid, return_to, {M,F,A}}, PrevTs, TsTy
make_ts(timestamp) ->
erlang:now();
make_ts(monotonic_timestamp) ->
- erlang:monotonic_time();
+ erlang:monotonic_time(nano_seconds);
make_ts(strict_monotonic_timestamp) ->
- MT = erlang:monotonic_time(),
+ MT = erlang:monotonic_time(nano_seconds),
UMI = erlang:unique_integer([monotonic]),
{MT, UMI}.
--
cgit v1.2.3