aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-04-27 10:09:33 +0200
committerBjörn Gustavsson <[email protected]>2015-04-27 10:09:33 +0200
commit6f0a08d85feac7103b573e20d6250ea880c6400f (patch)
tree4becfa81c3f29e0c885c9ea722be2b5e76abdd88 /lib/compiler/src
parent19c7d1f88c8d393ee6b9ba82b36389f01b5c0372 (diff)
parent47e7f00fe52ceb675c94a4800c297ce98d6bee30 (diff)
downloadotp-6f0a08d85feac7103b573e20d6250ea880c6400f.tar.gz
otp-6f0a08d85feac7103b573e20d6250ea880c6400f.tar.bz2
otp-6f0a08d85feac7103b573e20d6250ea880c6400f.zip
Merge branch 'bjorn/use-monotonic-time'
* bjorn/use-monotonic-time: supervisor: Correct restart handling test_server: Use erlang:monotonic_time/0 compile: Teach 'time' option to show three significant decimals timer: Use monotonic_time/0 in tc/1,2,3
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/compile.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 0b021073db..5bd33c4d18 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -329,15 +329,14 @@ fold_comp([{Name,Pass}|Ps], Run, St0) ->
fold_comp([], _Run, St) -> {ok,St}.
run_tc({Name,Fun}, St) ->
- Before0 = statistics(runtime),
+ T1 = erlang:monotonic_time(),
Val = (catch Fun(St)),
- After0 = statistics(runtime),
- {Before_c, _} = Before0,
- {After_c, _} = After0,
+ T2 = erlang:monotonic_time(),
+ Elapsed = erlang:convert_time_unit(T2 - T1, native, milli_seconds),
Mem0 = erts_debug:flat_size(Val)*erlang:system_info(wordsize),
Mem = lists:flatten(io_lib:format("~.1f kB", [Mem0/1024])),
- io:format(" ~-30s: ~10.2f s ~12s\n",
- [Name,(After_c-Before_c) / 1000,Mem]),
+ io:format(" ~-30s: ~10.3f s ~12s\n",
+ [Name,Elapsed/1000,Mem]),
Val.
run_eprof({Name,Fun}, Name, St) ->