aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/test/mnesia_cost.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-06-24 07:59:00 +0200
committerDan Gudmundsson <[email protected]>2015-06-30 09:26:49 +0200
commitf940d1cc510b9eb86a2562f190825b17a31acee2 (patch)
tree54363e0cae29626ad0fc33e6dedd993044707646 /lib/mnesia/test/mnesia_cost.erl
parent74a95b3d511177a9b35c2b0272b9ca5511b6f750 (diff)
downloadotp-f940d1cc510b9eb86a2562f190825b17a31acee2.tar.gz
otp-f940d1cc510b9eb86a2562f190825b17a31acee2.tar.bz2
otp-f940d1cc510b9eb86a2562f190825b17a31acee2.zip
Remove erlang:now() and random usage in tests
Diffstat (limited to 'lib/mnesia/test/mnesia_cost.erl')
-rw-r--r--lib/mnesia/test/mnesia_cost.erl10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/mnesia/test/mnesia_cost.erl b/lib/mnesia/test/mnesia_cost.erl
index ff0108ced1..714dbaef27 100644
--- a/lib/mnesia/test/mnesia_cost.erl
+++ b/lib/mnesia/test/mnesia_cost.erl
@@ -108,11 +108,11 @@ run(What, OtherInfo, Ops, F) ->
run(t, What, OtherInfo, Ops, F).
run(How, What, OtherInfo, Ops, F) ->
- T1 = erlang:now(),
+ T1 = erlang:monotonic_time(),
statistics(runtime),
do_times(How, ?TIMES, F),
{_, RunTime} = statistics(runtime),
- T2 = erlang:now(),
+ T2 = erlang:monotonic_time(),
RealTime = subtr(T1, T2),
report(How, What, OtherInfo, Ops, RunTime, RealTime).
@@ -140,11 +140,7 @@ report(dirty, What, OtherInfo, Ops, RunTime, RealTime) ->
subtr(Before, After) ->
- E =(element(1,After)*1000000000000
- +element(2,After)*1000000+element(3,After)) -
- (element(1,Before)*1000000000000
- +element(2,Before)*1000000+element(3,Before)),
- E div 1000.
+ erlang:convert_time_unit(After-Before, native, milli_seconds).
do_times(t, I, F) ->
do_trans_times(I, F);