aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/estone_SUITE.erl
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-03-29 01:29:23 +0100
committerRickard Green <[email protected]>2015-05-06 15:58:32 +0200
commitf0d51083a6cda851ed60578a7679e20b1fe5678a (patch)
tree5a226fc49118adf9b42f4594c843082d9328a03f /erts/emulator/test/estone_SUITE.erl
parente135070d4c7135228756e6a43dbdd638b565a499 (diff)
downloadotp-f0d51083a6cda851ed60578a7679e20b1fe5678a.tar.gz
otp-f0d51083a6cda851ed60578a7679e20b1fe5678a.tar.bz2
otp-f0d51083a6cda851ed60578a7679e20b1fe5678a.zip
Replace erlang:now() usage in emulator suite
Diffstat (limited to 'erts/emulator/test/estone_SUITE.erl')
-rw-r--r--erts/emulator/test/estone_SUITE.erl19
1 files changed, 7 insertions, 12 deletions
diff --git a/erts/emulator/test/estone_SUITE.erl b/erts/emulator/test/estone_SUITE.erl
index 1de6d6fb56..9fe161cffc 100644
--- a/erts/emulator/test/estone_SUITE.erl
+++ b/erts/emulator/test/estone_SUITE.erl
@@ -339,7 +339,6 @@ micros() ->
].
macro(Ms,DataDir) ->
- erlang:now(), %% compensate for old 4.3 firsttime clock bug :-(
statistics(reductions),
statistics(runtime),
lists(500), %% fixup cache on first round
@@ -369,10 +368,9 @@ run_micro(Top, M, DataDir) ->
apply_micro(M) ->
{GC0, Words0, _} = statistics(garbage_collection),
statistics(reductions),
- Before = erlang:now(),
-
+ Before = erlang:monotonic_time(),
Compensate = apply_micro(M#micro.function, M#micro.loops),
- After = erlang:now(),
+ After = erlang:monotonic_time(),
{GC1, Words1, _} = statistics(garbage_collection),
{_, Reds} = statistics(reductions),
Elapsed = subtr(Before, After),
@@ -391,10 +389,7 @@ apply_micro(M) ->
subtr(Before, After) ->
- (element(1,After)*1000000000000
- +element(2,After)*1000000+element(3,After)) -
- (element(1,Before)*1000000000000
- +element(2,Before)*1000000+element(3,Before)).
+ erlang:convert_time_unit(After-Before, native, micro_seconds).
gci(Micros, Words, Gcs) ->
((256 * Gcs) / Micros) + (Words / Micros).
@@ -633,10 +628,10 @@ tup_trav(T, P, End) ->
%% Port I/O
port_io(I) ->
EstoneCat = get(estone_cat),
- Before = erlang:now(),
+ Before = erlang:monotonic_time(),
Pps = make_port_pids(5, I, EstoneCat), %% 5 ports
send_procs(Pps, go),
- After = erlang:now(),
+ After = erlang:monotonic_time(),
wait_for_pids(Pps),
subtr(Before, After).
@@ -854,10 +849,10 @@ handle_call(_From, State, [abc]) ->
%% Binary handling, creating, manipulating and sending binaries
binary_h(I) ->
- Before = erlang:now(),
+ Before = erlang:monotonic_time(),
P = spawn(?MODULE, echo, [self()]),
B = list_to_binary(lists:duplicate(2000, 5)),
- After = erlang:now(),
+ After = erlang:monotonic_time(),
Compensate = subtr(Before, After),
binary_h_2(I, P, B),
Compensate.