summaryrefslogtreecommitdiff
path: root/src/rabbit.erl
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-07-30 17:33:05 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-08-05 16:16:38 +0200
commitd718d4c5af58418cad3b6e8d7747efef66d5f801 (patch)
treebd848d444fe64c46d7c4a9cd6d931a135fd9c791 /src/rabbit.erl
parent40b5c82b4b0feeab28fa85c2f1855590b722fc08 (diff)
downloadrabbitmq-server-git-d718d4c5af58418cad3b6e8d7747efef66d5f801.tar.gz
Use monotonic_time() to compute elapsed time
... not `erlang:now()` (deprecated) or `os:timestamp()` (which could go backward). file_handle_cache: While here, change the LRU tree key from `erlang:now()` to a combination of the monotonic time and the handle reference (which was the value in the tree previously). This is required as the monotonic time doesn't increase strictly: two subsequent calls could return the same time, leading to non-unique key. We could use unique_integer([monotonic]) but it's a bit heavy weight just to keep a rough order of opened files. So now, files sharing the same age are arbitrary "sorted" by their reference. References #233.
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r--src/rabbit.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index d218a07a98..5152c11eeb 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -277,7 +277,7 @@ hipe_compile() ->
Count = length(HipeModules),
io:format("~nHiPE compiling: |~s|~n |",
[string:copies("-", Count)]),
- T1 = erlang:now(),
+ T1 = time_compat:monotonic_time(),
PidMRefs = [spawn_monitor(fun () -> [begin
{ok, M} = hipe:c(M, [o3]),
io:format("#")
@@ -288,8 +288,8 @@ hipe_compile() ->
{'DOWN', MRef, process, _, normal} -> ok;
{'DOWN', MRef, process, _, Reason} -> exit(Reason)
end || {_Pid, MRef} <- PidMRefs],
- T2 = erlang:now(),
- Duration = timer:now_diff(T2, T1) div 1000000,
+ T2 = time_compat:monotonic_time(),
+ Duration = time_compat:convert_time_unit(T2 - T1, native, seconds),
io:format("|~n~nCompiled ~B modules in ~Bs~n", [Count, Duration]),
{ok, Count, Duration}.