summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-11-13 09:22:02 +0000
committerSimon MacMullen <simon@rabbitmq.com>2014-11-13 09:22:02 +0000
commitcab3f90898beac09f77d75219800f84b52f16c05 (patch)
tree497922d31f1f8e3a661e449dbd017acf8b4ebf87
parentbdf4ff4178502d7e558067d3721ec8cb1ec1dd78 (diff)
downloadrabbitmq-server-cab3f90898beac09f77d75219800f84b52f16c05.tar.gz
R13B03 compatibility.
-rw-r--r--src/file_handle_cache_stats.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/file_handle_cache_stats.erl b/src/file_handle_cache_stats.erl
index b1fbb3f4..832f0b3d 100644
--- a/src/file_handle_cache_stats.erl
+++ b/src/file_handle_cache_stats.erl
@@ -32,14 +32,14 @@ init() ->
Counter <- [count]].
update(Op, Bytes, Thunk) ->
- {Time, Res} = timer:tc(Thunk),
+ {Time, Res} = timer_tc(Thunk),
ets:update_counter(?TABLE, {Op, count}, 1),
ets:update_counter(?TABLE, {Op, bytes}, Bytes),
ets:update_counter(?TABLE, {Op, time}, Time),
Res.
update(Op, Thunk) ->
- {Time, Res} = timer:tc(Thunk),
+ {Time, Res} = timer_tc(Thunk),
ets:update_counter(?TABLE, {Op, count}, 1),
ets:update_counter(?TABLE, {Op, time}, Time),
Res.
@@ -50,3 +50,11 @@ update(Op) ->
get() ->
lists:sort(ets:tab2list(?TABLE)).
+
+%% TODO timer:tc/1 was introduced in R14B03; use that function once we
+%% require that version.
+timer_tc(Thunk) ->
+ T1 = os:timestamp(),
+ Res = Thunk(),
+ T2 = os:timestamp(),
+ {timer:now_diff(T2, T1), Res}.