summaryrefslogtreecommitdiff
path: root/src/file_handle_cache_stats.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_handle_cache_stats.erl')
-rw-r--r--src/file_handle_cache_stats.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/file_handle_cache_stats.erl b/src/file_handle_cache_stats.erl
index d055d84a..b1fbb3f4 100644
--- a/src/file_handle_cache_stats.erl
+++ b/src/file_handle_cache_stats.erl
@@ -18,7 +18,7 @@
%% stats about read / write operations that go through the fhc.
--export([init/0, update/3, update/2, get/0]).
+-export([init/0, update/3, update/2, update/1, get/0]).
-define(TABLE, ?MODULE).
@@ -26,8 +26,10 @@ init() ->
ets:new(?TABLE, [public, named_table]),
[ets:insert(?TABLE, {{Op, Counter}, 0}) || Op <- [read, write],
Counter <- [count, bytes, time]],
- [ets:insert(?TABLE, {{Op, Counter}, 0}) || Op <- [sync],
- Counter <- [count, time]].
+ [ets:insert(?TABLE, {{Op, Counter}, 0}) || Op <- [sync, seek],
+ Counter <- [count, time]],
+ [ets:insert(?TABLE, {{Op, Counter}, 0}) || Op <- [reopen],
+ Counter <- [count]].
update(Op, Bytes, Thunk) ->
{Time, Res} = timer:tc(Thunk),
@@ -42,5 +44,9 @@ update(Op, Thunk) ->
ets:update_counter(?TABLE, {Op, time}, Time),
Res.
+update(Op) ->
+ ets:update_counter(?TABLE, {Op, count}, 1),
+ ok.
+
get() ->
lists:sort(ets:tab2list(?TABLE)).